Checking the umbraco.services.js 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';
asset.deferred.resolve(true);
} else {
asset.state = 'loaded';
angularHelper.safeApply(scope, function () {
asset.deferred.resolve(true);
});
}
});
} else if (asset.state === 'loaded') {
asset.deferred.resolve(true);
}
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 ?
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 umbraco.services.js module's assetsService.
Documentation for this service is provided here:
https://our.umbraco.com/apidocs/ui/#/api/umbraco.services.assetsService
I'm using the loadCss method, attempting to pass it an attribute as laid out below:
The stylesheet is being added to the page but without the attribute that I require:
Checking the umbraco.services.js module, it seems to be ignoring the attributes parameter within the loadCss method:
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!
I think the attribute parameter is not working since a very long time.
If you take a look at this commit : https://github.com/umbraco/Umbraco-CMS/commit/90bf6003786cb6bd1c7ff94c48102fa3d1998f6a#diff-ca9e001eb1d67c6dccdfdd7aeff07f77
You will see they changed the way assets are loaded (from yepnope to LazyLoad)
So it would be good to raise a issue.
Dave
is working on a reply...