ngx-mask icon indicating copy to clipboard operation
ngx-mask copied to clipboard

ngx-mask thousand separator and decimalmarker throws ExpressionChangedAfterItHasBeenCheckedError when value changes dynamically and has ngModel

Open LencyBhalodiya opened this issue 1 year ago • 0 comments

Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '2342342'. Current value: '234234'.

 <input mask="separator.2" [(ngModel)]="input" [decimalMarker]="','" [thousandSeparator]="thousand"  >
    {{input}}
    <button (click)="fill()" > change</button>
    fill() {
    this.thousand = ',';
  }

i am changing the value for thousandSeparator and decimalMarker based on selection of list from html select component it basically has 4 option for thousandseparator [ "," , ".", " ", "-" ]; and as per user selects options it updates input value;

Replication steps :- type value in input box more than 6-7 numbers and after that change value of thousandSeparator to anything else like "-" or "," or space and then above error gets replicated , works fine if input is not more than 4-5, even works something for more numbers too.. but not all the time

my project version "@angular/core": "^17.0.4", "@angular/forms": "^17.0.4", "ngx-mask": "^18.0.0",

Below is the basic replication of error (input number more than 6 and then click button to change thousandSep)

Screenshot

LencyBhalodiya avatar Jul 29 '24 11:07 LencyBhalodiya