question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Tag: Option to add new tag despite existing tag

See original GitHub issue

Is your feature request related to a problem? Please describe. Sometimes there are cases where I would like to add a new user to an existing database by name. If there’s already a user that has the same name I should still have the option to add a new tag.

Describe the solution you’d like Instead of the changes made here https://github.com/ng-select/ng-select/commit/d5e97af72201a3fbedb1fa78d6c69be61776c872, it would be nice if there could be an @Input that allows for the ‘Add Tag’ option appearing even if itemsList contains a match.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yuvgeekcommented, Oct 23, 2019

@hisham - I have raised PR for this feature request. #1394

0reactions
varnastadeuscommented, Oct 25, 2019

Ok, let’s start from the beginning. Default search filters items by label and if your item label matches, it just returns existing item. If you want to add item with the same label, just override searchFn.

<ng-select [items]="data"
           [addTag]="addTagFn"
           multiple="true"
           bindLabel="name"
           [searchFn]="searchFn"
           [(ngModel)]="selectedCompanies">
</ng-select>
searchFn(term: string, item: {name: string}) {
    return item.name.includes(term) && item.name !== term;
}
Screenshot 2019-10-25 at 20 40 46
Read more comments on GitHub >

github_iconTop Results From Across the Web

Replace remote tag with Git - Stack Overflow
Delete the tag on any remote before you push git push origin :refs/tags/<tagname>. or for our example: · Replace the tag to reference...
Read more >
Create, Add, or Remove Tags - Mailchimp
Click the Untag All drop-down menu and choose the tag you want to remove. Untag All Select tag; In the Are you sure?...
Read more >
Git - Tagging - Git SCM
In this section, you'll learn how to list existing tags, how to create and delete tags, and what the different types of tags...
Read more >
Tag your Amazon EC2 resources - AWS Documentation
To add additional tags, choose Add additional tags. Choose Add tag, and then enter a key and value, and select the resource type...
Read more >
[GA4] About connected site tags - Analytics Help
Add connected site tags · In the Property column, click Data Streams. · Click the row for the web data stream. · Under...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found