I've been successfully validating a textbox with angular2, and now I'm attempting to set a minimum character limit for the input. However, when I try to do this, I encounter the following error:
Expected validator to return a Promise or Observable
Here is the script that I am working with:
customerNumber: any;
constructor(public navCtrl: NavController,
public viewctrl: ViewController,
public formBuilder: FormBuilder,
public http: Http,
public alertCtrl: AlertController,
public loadingCtrl: LoadingController,
public toastCtrl: ToastController) {
this.verifyForm = this.formBuilder.group({
customerNumber: ['', Validators.required,Validators.minLength(5)]
});
}
And here is the corresponding HTML code:
<ion-item>
<ion-input type="text" formControlName="CustomerNumber" placeholder="Enter your Customer Number" [(ngModel)]="customerNumber"></ion-input>
</ion-item>