Skip to content Skip to sidebar Skip to footer

Reset Form In Angularjs

I need some advice on how to properly reset a form in Angular JS. I'm having my form's data pushed to a object called .services, but every time I hit submit I would like for that f

Solution 1:

Have you tried giving the form a name then calling $setPristine()?

Then call $scope.serviceForm.$setPristine();

Solution 2:

Why are you setting it to an empty string? Set new services to an empty object. You are using ng-model which should be able to set the key and value for you. Unless you want default values for the checkbox's in which you can set it to an object with the default values in there.

Post a Comment for "Reset Form In Angularjs"