I am adding a custom text in ng-select.When I am removing this text, It should not be added in dropdown list.
<ng-select [items]="companies" [addTag]="addTagFn" [hideSelected]="true" multiple="true" bindLabel="name" [(ngModel)]="selectedCompanies">
</ng-select>
.ts file
selectedCompanies;
companies: any[] = [];
companiesNames = ['Uber', 'Microsoft', 'Flexigen'];
ngOnInit() {
this.companiesNames.forEach((c, i) => {
this.companies.push({ id: i, name: c });
});
}
addTagFn(name) {
return { name: name, tag: true };
}
You can see in the last screenshot text is added in dropdown after removing I don't want this text in dropdown after removing.could you please help me with simple solution.