Required on Ion-input

#1

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

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

https://ionicframework.com/docs/developer-resources/forms/

#3

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

#4

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