[Stylesheets] Add style sheet loader

Add style sheet loader and move style sheets inclusion
out of index.html. WTD-591.
This commit is contained in:
Victor Woeltjen
2015-01-14 17:01:52 -08:00
parent 04ee5bbbb5
commit fcab62b498
3 changed files with 55 additions and 17 deletions

View File

@ -0,0 +1,31 @@
/*global define*/
define(
["angular"],
function (angular) {
"use strict";
function StyleSheetLoader(stylesheets, $document) {
var head = $document.find('head');
function addStyleSheet(stylesheet) {
var link = angular.element('<link>'),
path = [
stylesheet.bundle.path,
stylesheet.bundle.resources,
stylesheet.stylesheetUrl
].join("/");
link.attr("rel", "stylesheet");
link.attr("type", "text/css");
link.attr("href", path);
head.append(link);
}
stylesheets.forEach(addStyleSheet);
}
return StyleSheetLoader;
}
);