Handle Model Change in Angular 5 Component (Two-way-binding)
you can use the (ngModelChange) directive
<input [(ngModel)]="hello" (ngModelChange)="myFunction()"/>
code:
import { Component } from '@angular/core';
@Component({
selector: 'my-test',
templateUrl: './my-test.component.html',
styleUrls: ['./my-test.component.css']
})
export class MyTestComponent {
hello: string = "bonjour";
constructor() { }
myFunction() {
console.log(this.hello);
}
}