1. Introduce the ChangeDetectorRef component

import {ChangeDetectorRef} from '@angular/core'; constructor(public changeDetectorRef:ChangeDetectorRef) {}

2. Page code

<input type="text" placeholder="0.00" \[(ngModel)\]=" item.tmp \_STOCK" (ngModelChange)=" inputtrule ('stock',$event)"/ bb0

3. Perform the following method when the input field changes

// Trigger method inputRule(name, event) when ngModel changes {// When the input field enters 1... This.item.tmp \_STOCK = null; this.item.tmp \_STOCK = null; this.item.tmp \_STOCK = null; this.item.tmp \_STOCK = null; this.item.tmp \_STOCK = null; this.item.tmp \_STOCK = null. / / detectChanges () - from the component to each component performs a change detection enclosing changeDetectorRef. DetectChanges (); This.item.tmp \_STOCK = this.pubTool. NumRule (event); this.item.tmp \_STOCK = this.pubTool.numRule (event); }