uzhas
uzhas

Reputation: 925

How to empty value from input (ngModel)?

I have this input :

<input id="password" type="password" class="form-control" name="password" [(ngModel)]="password">

Now i have function submit where i check if user enter valid password if not that i have in else this:

else{
       this.error = true;
       this.message = 'Wrong username or email!'
     }

And how can i in else add something like this to empty this field :

this.password = '';

Upvotes: 0

Views: 970

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222682

You need to declare the password inside the component.

password: string;

Upvotes: 1

Related Questions