iknb/admin/directives/customOnChange.directive.js

16 lines
356 B
JavaScript
Raw Normal View History

2020-07-08 11:56:33 +00:00
'use strict';
angular
.module('sloDialectsAdmin')
.directive('customOnChange', function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var onChangeHandler = scope.$eval(attrs.customOnChange);
element.on('change', onChangeHandler);
element.on('$destroy', function () {
element.off();
});
}
};
});