Harvest-Dev / ng-select2

A select2 for Angular
MIT License
55 stars 32 forks source link

How to avoid unnecessary execution of update() (to make update() only work when the user selects an item) #65

Closed nouaim closed 3 months ago

nouaim commented 6 months ago

`<select2 [data]="choices" [value]="value" placeholder="select or add a type" minCountForSearch="0" autoCreate="true" (update)="update(file, $event)"

`

When we open the component, the function update() gets executed though the user hasn't clicked or done any action, how can we stop this behavior and make update() only run if the user selects an item.

nouaim commented 3 months ago

@Zefling console anything in the update function, you will see it gets printed although the user hasn't interacted at with the select2 field

Tibasa commented 3 months ago

Same problem.

nouaim commented 3 months ago

@Tibasa i got the answer here https://github.com/Harvest-Dev/ng-select2/issues/71#issuecomment-2258546149

Tibasa commented 3 months ago

@Tibasa i got the answer here #71 (comment)

Thanks!!! I installed 15.0.1 and the problem was resolved.

nouaim commented 3 months ago

@Tibasa you are welcome