I am currently working on creating an alert box that includes some inputs. I am trying to restrict the input to a maximum of 10 characters and ensure that only numbers are allowed.
Unfortunately, I haven't been able to find any helpful guides on this topic. Any assistance would be greatly appreciated.
> const alert = this.alertCtrl.create({
title: 'Please Enter your Mobile',
inputs: [
{
name: 'mobile',
placeholder: 'Mobile'
}
],
buttons: [
{
text: 'Done',
handler: data => {
if (data.mobile != "" || data.mobile != null) {
this.data3 = data.mobile;
this.storage.set('number', data.mobile);
}
else {
this.ionViewDidLoad();
}
}
}
]
});
alert.present();
Here is the code I have so far. My goal is to constrain the mobile input field to 10 characters, allow only numerical values, and verify if it is empty or not.