Resetting form after submit in Angularjs

You can reset a form by, $scope.formName.$setPristine(); but if you’re binding a model object to your inputs, you need to take care of clearing those too, ie:

$scope.currentRecord={};

EDIT

As ToodoN-Mike pointed out, don’t forget to set

$scope.formName.$setUntouched()

The $touched flag was introduced in angular 1.3.

Leave a Comment