Skip to content

Preload with href array fails #82

@cool-Blue

Description

@cool-Blue

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);
          });
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions