>(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; > }); > } > }; > }]); >})();>
> <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>>
this.$setPristine = function() { ctrl.$dirty = false; ctrl.$pristine = true; $animate.removeClass($element, DIRTY_CLASS); $animate.addClass($element, PRISTINE_CLASS); };