Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions angular-css-injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ angular.module('angular.css.injector', [])
.provider('cssInjector', function() {
var singlePageMode = false;

function CssInjector($compile, $rootScope){
function CssInjector($compile, $rootScope, $rootElement){
// Variables
var head = angular.element(document.getElementsByTagName('head')[0]),
scope;
Expand All @@ -27,8 +27,7 @@ angular.module('angular.css.injector', [])
{
if(scope === undefined)
{
if((scope = head.scope()) === undefined) // We initialise head's scope in a separated function because it is not defined at the time of the initialisation of the service.
throw("angular.css.injector error : Please initialize your app in the HTML tag and be sure your page has a HEAD tag.");
scope = $rootElement.scope();
}
};

Expand Down Expand Up @@ -83,8 +82,8 @@ angular.module('angular.css.injector', [])
};
}

this.$get = ['$compile', '$rootScope', function($compile, $rootScope){
return new CssInjector($compile, $rootScope);
this.$get = ['$compile', '$rootScope', '$rootElement', function($compile, $rootScope, $rootElement){
return new CssInjector($compile, $rootScope, $rootElement);
}];

this.setSinglePageMode = function(mode){
Expand Down