using (ngModelChange) twice

Viewed 2854

I use angular 2 multiselect dropdown and it is performing the way i expected it to.

I have a doubt with the below mentioned usage :

<ss-multiselect-dropdown #dropdown [options]="dataObject" [texts]="myTexts" [settings]="mySettings" (ngModelChange)="onSelect($event)" (ngModelChange)='dropdown.clearSearch({})' [ngModel]="dataSelected"></ss-multiselect-dropdown>

Why is it that there is no error thrown for using ngModelChange twice, Since ,i've already bound ngModelchange with onSelect($event) ?

Thanks ,

2 Answers

If you look in the ngModel source code you will see that ngModelChange is Angular's EventEmmiter.

You subscribed to this emmiter twice. There is nothing wrong with that.

You can set the only one ngmodelChange;

Related