Karthik Karthik - 2 months ago 33
AngularJS Question

How to modify the angular ng- tags input plugin?

I am getting the below error when ng-tags input autocomplete function try to display the same name twice..

I mean if I give "R" in input box two rob are there means, I am getting the below error,

Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: item in suggestionList.items track by track(item),

I knew that ng-repeat wont accept duplicates but I don't how to modify the plugin to accept the duplicates.

The plugin that I am using is ng-tags input , https://github.com/mbenford/ngTagsInput/blob/master/src/tags-input.js

Answer

Are you sure you need to change the plugin? the home page shows it working http://mbenford.github.io/ngTagsInput/

variable in expression track by tracking_expression

from the doumentation https://docs.angularjs.org/api/ng/directive/ngRepeat

<ul ng-repeat="item in items track by $id(item)">
 ...