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

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

要么

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

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

{ 
name: String,_id: ObjectId,__v: Number,active: Boolean,display: Boolean,createDate: Date
}

我的HTML看起来像:

<tags-input
    ng-model="tags"
    displayProperty="name"
    placeholder="Add a tag">
    <auto-complete source="loadTags($query)"></auto-complete>
</tags-input>

而我的loadTags函数是:

$scope.loadTags = function(query) {

    return $http.get(configService.getApi() + '/tags?conditions=' + urlEncodeObject({name: { $regex: query }}),{
        headers: {
            'x-auth-token': sessionService.getToken()
        }
    });
};
displayProperty应该是display-property.卫生署!
原文链接:https://www.f2er.com/angularjs/141982.html

猜你在找的Angularjs相关文章