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

16 lines
437 B
JavaScript
Raw Normal View History

2019-11-12 16:09:47 +00:00
/**
* 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;
})
};
});