Angular UI-Select为"标记"添加重复标记对象

时间:2016-10-08 16:29:22

标签: javascript jquery angularjs tagging ui-select

我正在使用ui-select库进行"标记"特征

我使用的是对象数组,其中每个对象都有id和name。它工作正常。

如果我输入不存在的标签,它会创建一个我想要的新标签,但我唯一的问题是如果用户输入已经存在的标签,它会同时显示新标签和现有标签。 ui-select只有在尚未存在时才允许新标记。

enter image description here

如果我输入算法,那么它应该选择/显示现有的"算法"标记,而不是允许重复标记插入。

我无法找到任何设置。标记示例页面ui-select tagging example上也出现了同样的问题。 我想这不是那样的。那么在ui-select中这是可能的,还是应该在我的代码中处理它?任何解决方案?

这是我的代码:

<ui-select multiple tagging="questionVm.addNewTag" theme="select2" ng-model="addQueVm.newQuestion.tags" class="mdl-select">
    <ui-select-match  placeholder="Enter tags">
        <span ng-bind="$item.name"></span>
    </ui-select-match>
    <ui-select-choices repeat="tag in (questionVm.allTags | filter: $select.search)">
        <span ng-bind="tag.name"></span>
    </ui-select-choices>
</ui-select>

0 个答案:

没有答案