onchange event in angular 8 code example

Example 1: angular input onchange

<input (change)="saverange()"/>

Example 2: ngmodel onchange

(ngModelChange)="onModelChange()"

Example 3: ngchange angular 8

import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  template: `
    <input type="number" [ngModel]="percent" (ngModelChange)="onPercentChange($event)" />
  `,
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  {
  percent = 20;

  onPercentChange(percent: number) {
    console.log('here');  

    this.percent = percent;
  }
}

Tags:

Html Example