From 276a0bab7692ea8e768d80e52368b7709d0d8b6f Mon Sep 17 00:00:00 2001 From: E Brent Nelson Date: Sun, 26 Oct 2014 00:24:17 -0700 Subject: [PATCH 1/3] Allow use of custom interpolate symbols. Remove hardcoded interpolate symbols and replace with dynamic ones. --- angular-css-injector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-css-injector.js b/angular-css-injector.js index dd50f16..c8fda88 100644 --- a/angular-css-injector.js +++ b/angular-css-injector.js @@ -7,7 +7,7 @@ * https://github.com/Yappli/angular-css-injector/ */ angular.module('angular.css.injector', []) -.provider('cssInjector', function() { +.provider('cssInjector', function($interpolateProvider) { var singlePageMode = false; function CssInjector($compile, $rootScope){ @@ -40,7 +40,7 @@ angular.module('angular.css.injector', []) if(scope.injectedStylesheets === undefined) { scope.injectedStylesheets = []; - head.append($compile("")(scope)); // Found here : http://stackoverflow.com/a/11913182/1662766 + head.append($compile("")(scope)); // Found here : http://stackoverflow.com/a/11913182/1662766 } else { From cd6fe3f66ea4ca9052ad4beb1b1b61897b0d8ca8 Mon Sep 17 00:00:00 2001 From: E Brent Nelson Date: Sun, 26 Oct 2014 00:34:37 -0700 Subject: [PATCH 2/3] Fix potential problems with minification. Without stringifying the injected provider, we'd lose it in the minification process. --- angular-css-injector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-css-injector.js b/angular-css-injector.js index c8fda88..b5e18d3 100644 --- a/angular-css-injector.js +++ b/angular-css-injector.js @@ -7,7 +7,7 @@ * https://github.com/Yappli/angular-css-injector/ */ angular.module('angular.css.injector', []) -.provider('cssInjector', function($interpolateProvider) { +.provider('cssInjector', ['$interpolateProvider', function($interpolateProvider) { var singlePageMode = false; function CssInjector($compile, $rootScope){ @@ -91,4 +91,4 @@ angular.module('angular.css.injector', []) singlePageMode = mode; return this; } -}); +}]); From 71cd846d310f1f0ce6580a8b172cc9826ba98451 Mon Sep 17 00:00:00 2001 From: E Brent Nelson Date: Sun, 26 Oct 2014 00:43:02 -0700 Subject: [PATCH 3/3] Update minified version of library. I didn't know what minification process was used previously. Went with closure compiler to do this. --- angular-css-injector.min.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/angular-css-injector.min.js b/angular-css-injector.min.js index 334a684..8c06286 100644 --- a/angular-css-injector.min.js +++ b/angular-css-injector.min.js @@ -1,2 +1,4 @@ /* https://github.com/Yappli/angular-css-injector v1.0.4 */ - -"use strict";angular.module("angular.css.injector",[]).provider("cssInjector",function(){function t(e,t){var n=false,r=angular.element(document.getElementsByTagName("head")[0]),i;t.$on("$locationChangeStart",function(){if(n===true)u()});var s=function(){if(i===undefined){if((i=r.scope())===undefined)throw"angular.css.injector error : Please initialize your app in the HTML tag and be sure your page has a HEAD tag."}};var o=function(t){s();if(i.injectedStylesheets===undefined){i.injectedStylesheets=[];r.append(e("")(i))}else{for(var n in i.injectedStylesheets){if(i.injectedStylesheets[n].href==t)return}}i.injectedStylesheets.push({href:t})};var u=function(){s();if(i.injectedStylesheets!==undefined)i.injectedStylesheets=[]};return{add:o,removeAll:u}}var e=false;this.$get=["$compile","$rootScope",function(e,n){return new t(e,n)}];this.setSinglePageMode=function(t){e=t;return this}}) +-"use strict";angular.module("angular.css.injector",[]).provider("cssInjector",["$interpolateProvider",function(f){function m(b,d){var g=angular.element(document.getElementsByTagName("head")[0]),a;d.$on("$locationChangeStart",function(){!0===h&&k()});var e=function(){if(void 0===a&&void 0===(a=g.scope()))throw"angular.css.injector error : Please initialize your app in the HTML tag and be sure your page has a HEAD tag.";},k=function(){e();void 0!==a.injectedStylesheets&&(a.injectedStylesheets=[])};return{add:function(l){e(); +if(void 0===a.injectedStylesheets)a.injectedStylesheets=[],g.append(b("")(a));else for(var c in a.injectedStylesheets)if(a.injectedStylesheets[c].href==l)return;a.injectedStylesheets.push({href:l})},remove:function(b){e();if(a.injectedStylesheets)for(var c=0;c