In the example beneath, is it possible to ignore the dirty state of the dropdown list? Now it get\'s dirty if the user changes the selected person. But I don\'t care if this fie
boindiil's directive based solution works but has a flaw: it stops working if form's $setPritine
is executed manually. This can be solved by adding an extra line that wipes out the method behavior for the input:
angular.module('myApp', []).directive('ignoreDirty', [function() {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, elm, attrs, ctrl) {
ctrl.$setPristine = function() {};
ctrl.$pristine = false;
}
}
}]);