Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

Reset Form

Ghislain B. edited this page Jun 15, 2015 · 10 revisions

Angular-Validation is using the $touched property for showing/hiding the errors, so if you want to reset your form then you should use the $setUntouched() on your Form and you probably want to use the $setPristine() as well. As shown in the Angular Guide, you can do the following

HTML

<input type="button" ng-click="reset(form)" value="Reset" />

Javascript (inside Controller)

$scope.reset = function(form) {
    if (form) {
      form.$setPristine();
      form.$setUntouched();
    }
    $scope.user = angular.copy($scope.master);
};
Clone this wiki locally