Required on Ion-input

I’m adding a simple input which is required, but i’m facing a strange behavior, when i first click the input, dont write anything & click away from the input , the input doesn’t go red, but when i again do this, the input turns red. Isn’t it supposed to turn red on 1st attempt ?

<ion-content>
  <ion-item>
    <ion-label>Write here</ion-label>
    <ion-input type="text" [(ngModel)]="username" required></ion-input>
  </ion-item>
</ion-content>

2 Likes

if you want form attribute on ion-input or other element then you have to bind it in formmodule

Open-Source Form Builder for Creating Ionic Forms in Angular 2

i just tried taking it inside the form tag, but its still behaving same. any ideas ?

Same exact problem with me. Hope someone can tell us what’s wrong sooner or later