You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 8, 2023. It is now read-only.
head=angular.element(document.querySelector('head')),// TO make the code IE < 8 compatible, include jQuery in your page and replace "angular.element(document.querySelector('head'))" by "angular.element('head')"
16
+
scope;
16
17
17
18
// Capture the event `locationChangeStart` when the url change. If singlePageMode===TRUE, call the function `removeAll`
angular.element(document.querySelector('head')).append($compile("<link data-ng-repeat='stylesheet in href_array_dynamicStylesheets' data-ng-href='{{stylesheet.href}}' rel='stylesheet' />")(scope));// Found here : http://stackoverflow.com/a/11913182/1662766
39
+
scope.injectedStylesheets=[];
40
+
head.append($compile("<link data-ng-repeat='stylesheet in injectedStylesheets' data-ng-href='{{stylesheet.href}}' rel='stylesheet' />")(scope));// Found here : http://stackoverflow.com/a/11913182/1662766
40
41
}
41
42
else
42
43
{
43
-
for(variinscope.href_array_dynamicStylesheets)
44
+
for(variinscope.injectedStylesheets)
44
45
{
45
-
if(scope.href_array_dynamicStylesheets[i].href==href)// An url can't be added more than once. I use a loop FOR, not the function indexOf to make IE < 9 compatible
46
+
if(scope.injectedStylesheets[i].href==href)// An url can't be added more than once. I use a loop FOR, not the function indexOf to make the code IE < 9 compatible
scope.href_array_dynamicStylesheets=[];// Make it empty
59
+
if(scope.injectedStylesheets!==undefined)
60
+
scope.injectedStylesheets=[];// Make it empty
60
61
};
61
62
62
63
// Used to set the boolean `singlePageMode`. If singlePageMode===TRUE, the function `removeAll` will be call every time the page change (based on the angular event `$locationChangeStart`)
63
64
varsetSinglePageMode=function(bool)
64
65
{
65
66
if(bool!==true&&bool!==false)
66
-
throw("Angular service `dynamicStylesheets` : function `setSinglePageMode` : Error parameter, boolean required.");
67
+
throw("Angular service `cssInjector` : function `setSinglePageMode` : Error parameter, boolean required.");
0 commit comments