Angular model value changed event

In Angular, when a model changes, the onModelChange event may send a previous value or the new one depending on the position of the HTML attribute.

This:

[(ngModel)]="someprop" (ngModelChange)="onChange()"

fires "onChange" when the someprop has been assigned with the new value.

While this:

(ngModelChange)="onChange()" [(ngModel)]="someprop" 

fires "onChange" right before the someprop has been modified.


Post a Comment

Previous Post Next Post