dismiss.js 455 B

1234567891011121314151617
  1. 'use strict';
  2. /**
  3. * A directive used for "close buttons" (eg: alert box).
  4. * It hides its parent node that has the class with the name of its value.
  5. */
  6. app.directive('ctDismiss', function () {
  7. return {
  8. restrict: 'A',
  9. link: function (scope, elem, attrs) {
  10. elem.on('click', function (e) {
  11. elem.parent('.' + attrs.ctDismiss).hide();
  12. e.preventDefault();
  13. });
  14. }
  15. };
  16. });