angular-css.js
function addViaMediaQuery(stylesheet) {
        if (!stylesheet) {
            if(DEBUG) $log.error('No stylesheet provided');
            return;
        }
        // Media query object
        mediaQuery[stylesheet.href] = $window.matchMedia(stylesheet.media);
        // Media Query Listener function
        mediaQueryListener[stylesheet.href] = function(mediaQuery) {
          // Trigger digest
          $timeout(function () {
            if (mediaQuery.matches) {
              // Add stylesheet
              $rootScope.stylesheets.push(stylesheet);
            } else {
              var index = $rootScope.stylesheets.indexOf($filter('filter')($rootScope.stylesheets, {
                href: stylesheet.href
              })[0]);
              // Remove stylesheet
              if (index !== -1) {
                $rootScope.stylesheets.splice(index, 1);
              }
            }
          });
        };
        // Listen for media query changes
        mediaQuery[stylesheet.href].addListener(mediaQueryListener[stylesheet.href]);
        // Invoke first media query check
        mediaQueryListener[stylesheet.href](mediaQuery[stylesheet.href]);
      }
function addViaMediaQuery(stylesheet) {
        if (!stylesheet) {
            if(DEBUG) $log.error('No stylesheet provided');
            return;
        }
        // Media query object
        mediaQuery[stylesheet.href] = $window.matchMedia(stylesheet.media);
        // Media Query Listener function
        mediaQueryListener[stylesheet.href] = function(mediaQuery) {
          // Trigger digest
          $timeout(function () {
            if (mediaQuery.matches) {
              // Add stylesheet
              $rootScope.stylesheets.push(stylesheet);
            } else {
              var index = $rootScope.stylesheets.indexOf($filter('filter')($rootScope.stylesheets, {
                href: stylesheet.href
              })[0]);
              // Remove stylesheet
              if (index !== -1) {
                $rootScope.stylesheets.splice(index, 1);
              }
            }
          });
        };
        // Listen for media query changes
        mediaQuery[stylesheet.href].addListener(mediaQueryListener[stylesheet.href]);
        // Invoke first media query check
        mediaQueryListener[stylesheet.href](mediaQuery[stylesheet.href]);
      }
function addViaMediaQuery ( stylesheet ) { if ( ! stylesheet ) { if ( DEBUG ) $log . error ( 'No stylesheet provided' ) ; return ; } // Media query object mediaQuery [ stylesheet . href ] = $window . matchMedia ( stylesheet . media ) ; // Media Query Listener function mediaQueryListener [ stylesheet . href ] = function ( mediaQuery ) { // Trigger digest $timeout ( function ( ) { if ( mediaQuery . matches ) { // Add stylesheet $rootScope . stylesheets . push ( stylesheet ) ; } else { var index = $rootScope . stylesheets . indexOf ( $filter ( 'filter' ) ( $rootScope . stylesheets , { href : stylesheet . href } ) [ 0 ] ) ; // Remove stylesheet if ( index !== - 1 ) { $rootScope . stylesheets . splice ( index , 1 ) ; } } } ) ; } ; // Listen for media query changes mediaQuery [ stylesheet . href ] . addListener ( mediaQueryListener [ stylesheet . href ] ) ; // Invoke first media query check mediaQueryListener [ stylesheet . href ] ( mediaQuery [ stylesheet . href ] ) ; }
Add Media Query
Add Media Query