1<input type="text" [ngModel]="mymodel" (ngModelChange)="valuechange($event)" />
2{{mymodel}}
3
4valuechange(newValue) {
5 mymodel = newValue;
6 console.log(newValue)
7}
1import { Component } from '@angular/core';
2
3@Component({
4 selector: 'my-app',
5 template: `
6 <input type="number" [ngModel]="percent" (ngModelChange)="onPercentChange($event)" />
7 `,
8 styleUrls: [ './app.component.css' ]
9})
10export class AppComponent {
11 percent = 20;
12
13 onPercentChange(percent: number) {
14 console.log('here');
15
16 this.percent = percent;
17 }
18}
19