Angular, typescript change detection input text

gkucmierz picture gkucmierz · Mar 2, 2017 · Viewed 12.4k times · Source

I can't find simple and easy solution how to detect change in my textfield. I dont want to use (keypress) because the user will sometimes paste values into the field. (onchange) for example is working only when user will blur field. And I want to detect change immediately.

What is the easiest angular js $watch equivalent?

Answer

Sajeetharan picture Sajeetharan · Mar 2, 2017

use ngModelChange

input id="form_name" [(ngModel)]="quantity" (ngModelChange)="calculateTotal($event)"