lemoncodes
lemoncodes

Reputation: 2421

Added tag doe not added to ngx-chips model

i am having a hard time understanding how new entry is added to the array of object specified in the directory.

I am using ngx-chips

Here is the sample code i made

here is the ngx-chip directive

<tag-input [ngModel]="items" (onAdd)="onFilterRuleAdded($event)"></tag-input>

Basically every time i add a new chip, it does not get added to my items When i check the console logs, items contains the same entries. no new entries were added

How do i add every new entry in the tag-input to the define model items

Upvotes: 0

Views: 941

Answers (1)

lemoncodes
lemoncodes

Reputation: 2421

Fount it.

Turns on that i forgot to do two way binding.

Refer to this thread

Basically i just enabled the two-way binding

Below is the working snippet

<tag-input [(ngModel)]="items" (onAdd)="onFilterRuleAdded($event)"></tag-input>

Do take on the [(ngModel)] syntax

Upvotes: 0

Related Questions