var dirty = false; >>angular.forEach(scope.theForm, function (value, key) { >> if (key[0] != '$') { >> if (value.$dirty) { >> dirty = true; >> } >> } >>}); >>if (!dirty) { >>scope.theForm.$setPristine(); >>}This will reset the form if all inputs are pristine.....
>require: ['^form'],>
var dirty = false; var theForm = null; angular.forEach(scope.theForm, function (value, key) { if (key == '$$parentForm') { theForm = value; } if (key[0] != '$') { if (value.$dirty) { dirty = true; } } }); if (!dirty) { theForm.$setPristine(); }(Uses the control to reach up to the parent form)