Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Dallas 5 posts 74 karma points c-trib
    Sep 26, 2018 @ 07:33

    assetsService.loadCss Ignores Attributes parameter

    I'm modifying a custom Property Editor and I require the ability to inject a stylesheet with custom attributes.

    I'm using the module's assetsService.

    Documentation for this service is provided here:

    I'm using the loadCss method, attempting to pass it an attribute as laid out below:

    assetsService.loadCss("style.css", $scope, { crossorigin: 'anonymous' }, 10000 )

    The stylesheet is being added to the page but without the attribute that I require:

    <link href="styles.css" rel="stylesheet" class="lazyload" charset="utf-8">

    Checking the module, it seems to be ignoring the attributes parameter within the loadCss method:

    loadCss: function (path, scope, attributes, timeout) {
                    path = convertVirtualPath(path);
                    var asset = this._getAssetPromise(path);
                    // $q.defer();
                    var t = timeout || 5000;
                    var a = attributes || undefined;
                    if (asset.state === 'new') {
                        asset.state = 'loading';
                        LazyLoad.css(appendRnd(path), function () {
                            if (!scope) {
                                asset.state = 'loaded';
                            } else {
                                asset.state = 'loaded';
                                angularHelper.safeApply(scope, function () {
                    } else if (asset.state === 'loaded') {
                    return asset.deferred.promise;

    I think this could be a bug with Umbraco but I thought I'd run it by here before raising an issue on GitHub. Has anybody here had experience with applying custom attributes using assetsServices.loadCss ?

    Thanks in advance!

  • Dave Woestenborghs 3495 posts 12101 karma points MVP 7x admin c-trib
    Sep 26, 2018 @ 08:02
    Dave Woestenborghs

    I think the attribute parameter is not working since a very long time.

    If you take a look at this commit :

    You will see they changed the way assets are loaded (from yepnope to LazyLoad)

    So it would be good to raise a issue.


Please Sign in or register to post replies

Write your reply to: