How to add clear button in ionic


#1

I want to make a form,which has a clear button,
and clicking on that button clears all the values of input box and radio buttons,
please help me with this,how to make a clear function which makes the textboxes empty and radiobuttons unchecked.
Thankyou


#2

You should create a form with the formbuilder (docs over here ). Then you can clear the entire form by calling formgroup.reset();


#3

will this work for ionic2 too?


#4

I have created the form:


now how should i add clear button function()?


Please help me in this…


#5

this is my button code:


#6

I don’t see a formgroup anywhere? Please do not use screenshots unless absolutely necessary, use code formatted with the </> button on the editor here. It’s a lot easier to read for everyone (screen readers, even for blind people ;)). Please read the part over here

about forms with formbuilders and ionic2


#7

Thanks ,I will definitely refer this.