angular-dirty-check
Version:
Dirty form checker for AngularJS
23 lines (19 loc) • 615 B
JavaScript
(function () {
'use strict';
angular
.module('angularDirtyCheck')
.directive('dirtyCheck', ['dirtyCheckService', function (dirtyCheckService) {
return {
require: 'form',
restrict: 'A',
link: link,
scope: {}
};
function link(scope, elem, attrs, controller) {
dirtyCheckService.registerForm(controller);
scope.$on('$destroy', function() {
dirtyCheckService.deregisterForm(controller);
});
}
}]);
})();