-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcssOnTheFly.js
More file actions
27 lines (25 loc) · 1.01 KB
/
Copy pathcssOnTheFly.js
File metadata and controls
27 lines (25 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
mainApp.directive('cssOnTheFly', ['$rootScope', function($rootScope) {
return {
restrict: 'E',
template: '',
replace: true,
compile: function compile(tElement, tAttrs, transclude) {
// In config .NET properties in 'UPPERCASE'. In config .php properties in 'UpperCamelCase'.
var debugProp = $rootScope.config.hasOwnProperty('DEBUG') ? 'DEBUG' : 'Debug';
var href = $rootScope.config[debugProp] ? tAttrs.hrefDebug : tAttrs.hrefRelease;
if ($("head > link[href='" + href + "']").length == 0) {
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: href
}).appendTo("head");
}
/*
return {
pre: function preLink(scope, iElement, iAttrs, controller) { },
post: function postLink(scope, iElement, iAttrs, controller) { }
};
*/
}
};
}]);