99angular . module ( 'angular.css.injector' , [ ] )
1010. provider ( 'cssInjector' , function ( ) {
1111 var singlePageMode = false ;
12-
12+
1313 function CssInjector ( $compile , $rootScope ) {
1414 // Variables
1515 var singlePageMode = false ,
1616 head = angular . element ( document . getElementsByTagName ( 'head' ) [ 0 ] ) ,
1717 scope ;
18-
18+
1919 // Capture the event `locationChangeStart` when the url change. If singlePageMode===TRUE, call the function `removeAll`
2020 $rootScope . $on ( '$locationChangeStart' , function ( )
2121 {
@@ -32,12 +32,12 @@ angular.module('angular.css.injector', [])
3232 throw ( "angular.css.injector error : Please initialize your app in the HTML tag and be sure your page has a HEAD tag." ) ;
3333 }
3434 } ;
35-
35+
3636 // Used to add a CSS files in the head tag of the page
3737 var addStylesheet = function ( href )
3838 {
3939 _initScope ( ) ;
40-
40+
4141 if ( scope . injectedStylesheets === undefined )
4242 {
4343 scope . injectedStylesheets = [ ] ;
@@ -51,29 +51,29 @@ angular.module('angular.css.injector', [])
5151 return ;
5252 }
5353 }
54-
54+
5555 scope . injectedStylesheets . push ( { href : href } ) ;
5656 } ;
57-
57+
5858 // Used to remove all of the CSS files added with the function `addStylesheet`
5959 var removeAll = function ( )
6060 {
6161 _initScope ( ) ;
62-
62+
6363 if ( scope . injectedStylesheets !== undefined )
6464 scope . injectedStylesheets = [ ] ; // Make it empty
6565 } ;
66-
66+
6767 return {
6868 add : addStylesheet ,
6969 removeAll : removeAll
7070 } ;
7171 }
72-
72+
7373 this . $get = function ( $compile , $rootScope ) {
7474 return new CssInjector ( $compile , $rootScope ) ;
7575 } ;
76-
76+
7777 this . setSinglePageMode = function ( mode ) {
7878 singlePageMode = mode ;
7979 return this ;
0 commit comments