Created
November 6, 2014 11:34
-
-
Save enapupe/38fa9aa4d88aa30d3dfa to your computer and use it in GitHub Desktop.
AngularJS auto $setPristine() on reset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module("myApp").directive("form", function(){ | |
return { | |
require: "^form", | |
link: function(scope, elem, attr, ctrl){ | |
elem.on("reset", function(){ | |
ctrl.$setPristine(); | |
}); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this directive triggers $setPristine() when the form receives reset event (via
<input type="reset">
, etc)