Ion-input max/min attibute doesn't work

Hi, there;
I am using ionic V6 Ion-input component, type='“number”, the max/min attibute doesn’t work.
Did anybody get it working?

Cheers,
Qiuwei

html code

   <form [formGroup]="myForm">

    <ion-item>
            <ion-label stacked>Pin Code</ion-label>
            <ion-input type="number" maxlength="6" [(ngModel)]="pincode" formControlName="pincode">
            </ion-input>
    </ion-item>
<form>

ty code

import { FormBuilder , Validators } from '@angular/forms';


export class DemoFormExample{

myForm:any;

constructor(public navCtrl: NavController,
              public navParams: NavParams,
              public formBuilder: FormBuilder){
this.myForm = formBuilder.group({
          pincode: ['', [Validators.required, Validators.minLength(8)]],

    })
}

i hope this will help you :+1:

Hi, vin001;
Thanks for the help. It works!. Changes needed: remove this:

In Angular it is now best practice to put your validators in the component side of creating the formGroup. Angular at least if you are creating a reactive form. I find this much easier to manage than putting in the template itself.

1 Like

Agree lazmeister!, keep this consistent

1 Like