Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Multiple Tagging with "Array of object" is allowing insertion of duplicate entries. #1820

@Rahul-Sagore

Description

@Rahul-Sagore

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.
screen shot 2016-09-25 at 12 59 18 pm

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

Activity

davidetwc

davidetwc commented on Oct 11, 2016

@davidetwc

Hi, I have th same issue...

Jefiozie

Jefiozie commented on Oct 14, 2016

@Jefiozie
Contributor

Are you using a custom tagging function? Or the default?

Rahul-Sagore

Rahul-Sagore commented on Oct 14, 2016

@Rahul-Sagore
Author

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.

Jefiozie

Jefiozie commented on Oct 14, 2016

@Jefiozie
Contributor

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.

added a commit that references this issue on Oct 20, 2016
zajacmp3

zajacmp3 commented on Oct 20, 2016

@zajacmp3

Hi Guys, I had the same issue and I fixed and tested it in above PR.

Rahul-Sagore

Rahul-Sagore commented on Oct 20, 2016

@Rahul-Sagore
Author

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.

Jefiozie

Jefiozie commented on Oct 20, 2016

@Jefiozie
Contributor

@zajacmp3, agree on the above comments also you are missing some test in your commit.

zajacmp3

zajacmp3 commented on Oct 20, 2016

@zajacmp3

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.

zajacmp3

zajacmp3 commented on Oct 20, 2016

@zajacmp3

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>
zajacmp3

zajacmp3 commented on Oct 20, 2016

@zajacmp3

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.

added a commit that references this issue on Oct 21, 2016
zajacmp3

zajacmp3 commented on Oct 21, 2016

@zajacmp3

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",
.
.
.
}
zajacmp3

zajacmp3 commented on Nov 22, 2016

@zajacmp3

Hi Guys,

They is no response from repo maintainers on PR:
#1830

Maybe some of you are familiar what maintainer meant? Is there any pending work to be done?

Thanks,
Mateusz

4 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @zajacmp3@Rahul-Sagore@UsamaKhalil-KSO@armory09@davidetwc

        Issue actions

          Multiple Tagging with "Array of object" is allowing insertion of duplicate entries. · Issue #1820 · angular-ui/ui-select