[(ngModel)] not working as expected

You should not need to be messing with zones or change detection. The following seems to do what you want:

<ion-input [ngModel]="quantity" (ngModelChange)="onQuantityChange($event)"></ion-input>

quantity: string;
maxValue = Number(100);

onQuantityChange(q: string): void {
  let qnum = Number.parseInt(q);
  if (qnum > this.maxValue) {
    this.quantity = this.maxValue.toString();
  } else if (qnum <= 0) {
    this.quantity = null;
  } else {
    this.quantity = qnum.toString();
  }
}
1 Like