This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/static/js/directives/ng-if-media.js
2019-11-12 11:09:47 -05:00

15 lines
437 B
JavaScript

/**
* Adds an ng-if-media attribute that evaluates a media query and, if false, removes the element.
*/
angular.module('quay').directive('ngIfMedia', function ($animate, AngularHelper) {
return {
transclude: 'element',
priority: 600,
terminal: true,
restrict: 'A',
link: AngularHelper.buildConditionalLinker($animate, 'ngIfMedia', function(value) {
return window.matchMedia(value).matches;
})
};
});