Moment For Technology

AngularJS two-way binding data input multiple decimal point problem (two-way binding does not refresh the problem)

Posted on Feb. 1, 2023, 2:35 p.m. by Joanne Goodwin
Category: typescript Tag: typescript angularjs ionic

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); }
About (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.