Reset input value in angular 2

you can do something like this

<input  placeholder="Name" #filterName name="filterName" />
<button (click) = "filterName.value=""">Click</button>

or

Template

<input mdInput placeholder="Name" [(ngModel)]="filterName" name="filterName" >
<button (click) = "clear()'">Click</button>

In component

filterName:string;
clear(){
this.filterName="";
}

Update

If it is a form

easiest and cleanest way to clear forms as well as their error states (dirty , prestine etc)

this.form_name.reset();

for more info on forms read out here

https://angular.io/docs/ts/latest/guide/forms.html

PS: As you asked question there is no form used in your question code
you are using simple two day data binding using ngModel not with
formControl.

form.reset() method works only for formControls reset call

A plunker to show how this will work link.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)