Ioinc 4 - form and submit button

Same here

  <form [formGroup]="userForm" (ngSubmit)="onSubmit()" padding-right>
    <ion-item>
      <ion-label position="floating">Email/Username</ion-label>
      <ion-input type="text" formControlName="email" required></ion-input>
    </ion-item>
    <ion-item>
      <ion-label position="floating">Password</ion-label>
      <ion-input type="password" formControlName="password" required></ion-input>
    </ion-item>
    <button type="submit" class="btn btn-primary">Submit</button>
    <ion-button type="submit" color="primary" expand="block" [disabled]="!userForm.valid">Login</ion-button>
</form>

Button works but ion button submit and refresh by itself.

======= Updated . =======

This one seem to work well.

  <form [formGroup]="userForm" padding-right>
    <ion-item>
      <ion-label position="floating">Email/Username</ion-label>
      <ion-input type="text" formControlName="email" required></ion-input>
    </ion-item>
    <ion-item>
      <ion-label position="floating">Password</ion-label>
      <ion-input type="password" formControlName="password" required></ion-input>
    </ion-item>

    <ion-button 
      color="primary" 
      expand="block" 
      [disabled]="!userForm.valid" 
      (click)="loginForm()">Login</ion-button>
</form>
2 Likes