(function () { 'use strict'; var app = angular.module('sysMgrApp'); app.directive('noDirtyCheck', [function () { // Interacting with input elements having this directive won't cause the // form to be marked dirty. // http://stackoverflow.com/questions/17089090/prevent-input-from-setting-form-dirty-angularjs return { restrict: 'A', require: 'ngModel', link: function (scope, element, attrs, ctrl) { element[0].focus(function () { ctrl.$pristine = false; }); } }; }]); })();and the page has this control:
<div class="col-lg-5 col-lg-offset-1"> <input class="form-control" type="text" ng-model="searchTerm" data-no:dirty-check ="true" placeholder="@Labels.search" /> </div>when I type something in that control and inspect the element, I can see the ng-dirty class on it.