angularjs – ngTagsInput“ngrepeat:dupes”和“无法读取属性’替换’未定义”

前端之家收集整理的这篇文章主要介绍了angularjs – ngTagsInput“ngrepeat:dupes”和“无法读取属性’替换’未定义”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图在ngTagsInput中使用自动完成,我收到以下错误
  1. Error: [ngRepeat:dupes] http://errors.angularjs.org/1.2.9/ngRepeat/dupes?p0=item%20in%20suggestionList.items%20track%20by%20track(item)&p1=undefined
  2. at Error (native)

要么

  1. TypeError: Cannot read property 'replace' of undefined
  2. at j (https://localhost:3000/js/plugins/ng-tags-input.min.js:1:5556)

我已经检查了几次,我的查询功能正在返回一个正确的标签数组,而且确实如此.它工作得很漂亮.标签的结构如下所示:

  1. {
  2. name: String,_id: ObjectId,__v: Number,active: Boolean,display: Boolean,createDate: Date
  3. }

我的HTML看起来像:

  1. <tags-input
  2. ng-model="tags"
  3. displayProperty="name"
  4. placeholder="Add a tag">
  5. <auto-complete source="loadTags($query)"></auto-complete>
  6. </tags-input>

而我的loadTags函数是:

  1. $scope.loadTags = function(query) {
  2.  
  3. return $http.get(configService.getApi() + '/tags?conditions=' + urlEncodeObject({name: { $regex: query }}),{
  4. headers: {
  5. 'x-auth-token': sessionService.getToken()
  6. }
  7. });
  8. };
displayProperty应该是display-property.卫生署!

猜你在找的Angularjs相关文章