apollodec/Apollo/assets/js/directives/dismiss.js
saravanakumar_kandasami 7d72a0b91a updated code
2017-11-21 14:56:39 +05:30

17 lines
455 B
JavaScript

'use strict';
/**
* A directive used for "close buttons" (eg: alert box).
* It hides its parent node that has the class with the name of its value.
*/
app.directive('ctDismiss', function () {
return {
restrict: 'A',
link: function (scope, elem, attrs) {
elem.on('click', function (e) {
elem.parent('.' + attrs.ctDismiss).hide();
e.preventDefault();
});
}
};
});