Can't bind to 'email' since it isn't a known property of 'ion-input'


#1

I tried to add email validation with this:

<ion-item>
                <ion-input type="email" placeholder="Email" [email]="true" name="email" [(ngModel)]="registerCredentials.email" #email="ngModel" required></ion-input>
              </ion-item>
              <div>
                {{email.errors | json}}
              </div>
              <div *ngIf="email.errors && (email.dirty || email.touched)"
                   class="alert alert-danger">
                <div [hidden]="!email.errors.email">
                  Name cannot be more than 20 characters long.
                </div>
              </div>

but I get this error:


#2

The error message even shows you where the problem is…


#3

It is not obvious for me

[email]=“true”

tells angular to validate the input as email


#4

But this doesn’t exist on <ion-input> per the error message.


#5

No it doesn’t. Please read the documentation.


#6

https://angular.io/api/forms/EmailValidator

see last example?


#7

That’s for Angular’s input. Your code uses ion-input.


#8

so how do i do it with ion-input?