@Ibernato93 wrote:
I’m using reactiveform.
When the user clicks on the button to enter data, I would like to call a method if the data entered by him are invalid.How can I do?
This is the form
createForm(){ this.userForm = this.fb.group({ email: ['', [Validators.required, Validators.email]], psw: ['', [Validators.required, Validators.minLength(8), Validators.maxLength(16),]] }); } <form [formGroup]="userForm" novalidate> <ion-item padding> <ion-label><ion-icon name="person"></ion-icon></ion-label> <ion-input type="email" placeholder="Email" formControlName="email"></ion-input> </ion-item> <ion-item padding> <ion-label><ion-icon name="key"></ion-icon></ion-label> <ion-input type="password" placeholder="Password" formControlName="psw"></ion-input> </ion-item> <button ion-button full (click)="login()" [disabled]="!userForm.valid">Login</button> </form>
Posts: 1
Participants: 1