Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addTag adds an object not a string? #315

Closed
LeahPike opened this issue Mar 2, 2018 · 4 comments · Fixed by #322
Closed

addTag adds an object not a string? #315

LeahPike opened this issue Mar 2, 2018 · 4 comments · Fixed by #322
Assignees
Labels

Comments

@LeahPike
Copy link

LeahPike commented Mar 2, 2018

Expected behaviour

I'm binding to a list of string, when I enable addTag and add a new value ( Purple ) it should add just a string to the array.

[ "Red", "Green", "Blue", "Purple", "Yellow" ]

Actual behaviour

It's adding an object to the array.

[ "Red", "Green", "Blue", { "label": "Purple" }, "Yellow" ]

More Info

If I add an existing tag ( Yellow ), it just adds the string.

    onAdd(value) {
        console.log(value);
    }

{label: "Purple"}
Yellow

ng-select version: 0.23.3

browser: Chrome Version 64.0.3282.186 (Official Build) (64-bit)

reproducible in demo page: N/A

@varnastadeus
Copy link
Member

varnastadeus commented Mar 2, 2018

@LeahPike you are probably using bindLabel which is not necessary since you have simple strings. If you have bindLabel provided, addTag will create object with that property because it must map label out from it.

@LeahPike
Copy link
Author

LeahPike commented Mar 4, 2018

I tried not setting the bindLabel at all, or setting it to empty, but it was persistent about wanting to add new tags as an object with a label property.

@varnastadeus varnastadeus added bug and removed question labels Mar 4, 2018
@varnastadeus
Copy link
Member

ok, I can confirm it is a bug.

@LeahPike
Copy link
Author

LeahPike commented Mar 6, 2018

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants