Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit 4b13e4f

Browse files
committed
added function for removing single stylesheets
1 parent c542165 commit 4b13e4f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

angular-css-injector.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ angular.module('angular.css.injector', [])
5454
scope.injectedStylesheets.push({href: href});
5555
};
5656

57+
var remove = function(href){
58+
_initScope();
59+
60+
if(scope.injectedStylesheets){
61+
for(var i = 0; i < scope.injectedStylesheets.length; i++){
62+
if(scope.injectedStylesheets[i].href === href){
63+
scope.injectedStylesheets.splice(i, 1);
64+
return;
65+
}
66+
}
67+
}
68+
};
69+
5770
// Used to remove all of the CSS files added with the function `addStylesheet`
5871
var removeAll = function()
5972
{
@@ -65,6 +78,7 @@ angular.module('angular.css.injector', [])
6578

6679
return {
6780
add: addStylesheet,
81+
remove: remove,
6882
removeAll: removeAll
6983
};
7084
}

0 commit comments

Comments
 (0)