Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preload with href array fails #82

Open
cool-Blue opened this issue May 7, 2017 · 0 comments
Open

Preload with href array fails #82

cool-Blue opened this issue May 7, 2017 · 0 comments

Comments

@cool-Blue
Copy link

in $css.preload, stylesheet.href is not tested for array-ness so,

this works...

      css: [
        'stylesheets/style.css',
        'https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.5/nv.d3.css',
        'views/visualize-nvd3/visialize-nvd3.css'
      ]

but this fails...

      css: {
        href: [
          'stylesheets/style.css',
          'views/visualize-nvd3/visialize-nvd3.css'
        ],
        preload: true,
        persist: true
      },

The former works whether or not preload is set true in global options.

The problem is that

        var stylesheetLoadPromises = [];
        angular.forEach(stylesheets, function(stylesheet, key) {
          stylesheet = stylesheets[key] = parse(stylesheet);
          stylesheetLoadPromises.push(
            // Preload via ajax request
            $http.get(stylesheet.href).catch(function (response) {
                if(DEBUG) $log.error('AngularCSS: Incorrect path for ' + stylesheet.href);
            })
          );
        });
        if (angular.isFunction(callback)) {
          $q.all(stylesheetLoadPromises).then(function () {
            callback(stylesheets);
          });
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant