Multiple Tagging with "Array of object" is allowing insertion of duplicate entries.
Bug description:
I created tagging feature, where user can select from existing stored tags or create new if not existed. So if I have one tag "Algorithm" in dropdown, and user type "algo" then it allows creating new one. But if user type "algorithm" or "Algorithm", then both existing tag and "create new" displays. So it should allow insertion of new tag only if it is not already existing tag.

This is the array, which populates the ui-select:
[ {uid: "0x943835545", name: "Algorithm"}]
Probably it should allow to filter on one property of object, for example name of the tag and ignore others. And if tag name exist then "Create new" label should disappear or disabled.
Link to minimally-working plunker that reproduces the issue:
This is happening on official Tagging example as well. This is someone else's plunker link. Check array of object example.
Version of Angular, UI-Select, and Bootstrap/Select2/Selectize CSS
Angular: AngularJS v1.3.13
UI-Select: 0.19.3
Hi, I have th same issue...
Are you using a custom tagging function? Or the default?
Custom tagging means user can add new tags on the fly, right? This is the code I wrote, where addNewTag function return user typed string.
<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>
I have handled the problem on frontend by calling custom function on "on-select" event, which handles unique tag insertion. But I wanted to know if there is something in-built in ui-select to make it unique based on single object property.
I had a look at the code but I cannot find any thing that makes it a unique value. Maybe this is something you could implement? I think this will add value to the ui-select.
Hi Guys, I had the same issue and I fixed and tested it in above PR.
Okay, that's great. Will test it. Hope you have tested it, and it's not breaking default functionalities, because this should be a configurable thing, not just default thing.
Not everybody need this.
@zajacmp3, agree on the above comments also you are missing some test in your commit.
Thanks, for fast reply. I wanted push it ASAP. Tests will be written too (not really TDD while debugging unknown plugin to me). In the scope of this changes we have to also propose changes to wiki. Any help much appreciated I am on hold with it till tomorrow.
My usage of it in html along with the tag:
<ui-select multiple ng-model="vm.tags" theme="bootstrap" close-on-select="true" tagging="vm.createNewTag" object-unique-key="name" limit="25" >
<ui-select-match>{{$item.name}}</ui-select-match>
<ui-select-choices refresh="vm.truncateLongTags($select)" refresh-delay="0" repeat="tag in (vm.availableTags | filter: $select.search) track by tag.id">
<div ng-bind-html="tag.name"></div>
</ui-select-choices>
</ui-select>
Added unit tests, corrected failing ones.
Functional is disabled by default. It is only enabled if you define the html tag object-unique-key.
I hope that will answer your concerns.
I registered my fix in bower so it can be moved further down the pipeline in my organization.
If you want to test it just add an entry in your projects bower.json
"dependencies": {
.
.
.
"angular-ui-select_duplicate_hot_fix": "v0.19.5.1",
.
.
.
}
Hi Guys,
They is no response from repo maintainers on PR: https://github.com/angular-ui/ui-select/pull/1830
Maybe some of you are familiar what maintainer meant? Is there any pending work to be done?
Thanks, Mateusz
Any update on this @Jefiozie
@usamakhalil86 feel free to ask if you have any questions. We are with success using this code on production for 6 months.
@zajacmp3 is this going to merge?
@armory09 I wish. Sadly I don't have permissions to do that. I see that there are conflicts on PR so I am going to resolve them soon.