Tutorialsplane

AngularJs Reset Form Fields


AngularJs Reset Form Fields : Sometimes we need to reset form fields in AngularJs. It is very easy to reset form fields in Angularjs . Here in this tutorial we are going to explain how you can reset form fields in AngularJs. You can use our online editor to try & edit the code.


AngularJs Reset Form Fields Example

You can reset form fields in angularjs as below โ€“

Html Part

Html Part Contains the form with two fields email and password which we will reset using the AngularJS.

AngularJs Reset Form Fields Example:

<div ng-app="myApp">  
<div ng-controller="myController">  

</div> 


</div>

JavaScript Part

Javascript part contains the following code to reset the form fields as below โ€“

AngularJs Reset Form Fields Example:

<div ng-app="myApp">  
<div ng-controller="myController">  

</div> 


</div>

Try it ยป

The above function will reset the two form fields email and passwords. On the same way you can clear more fields if your form has more fields.

If you run the above example it will produce the output something like this โ€“