Angular2 ngModelChange previous value
What you can do is,
DEMO : http://plnkr.co/edit/RXJ4D0YJrgebzYcEiaSR?p=preview
<input type="text"
[ngModel]="text" //<<<###changed [(ngModel)]="text" to [ngModel]="text"
(ngModelChange)="textChanged($event)">
private textChanged(event) {
console.log('changed', this.text, event);
this.text=event; //<<<###added
}
So found kinda weird(at least for me) possible solution for this with least changes in the code in question. So on assigning the (ngModelChange)
attribute before [(ngModel)]
what I get is following with the same handler:
changed *older value* *new value*
I get the new value in this.text
like so:
setTimeout(() => console.log(this.text), 0);