diff --git a/build/loading-bar.js b/build/loading-bar.js
index 5a548fc..501d6db 100644
--- a/build/loading-bar.js
+++ b/build/loading-bar.js
@@ -163,7 +163,7 @@ angular.module('cfp.loadingBar', [])
this.parentSelector = 'body';
this.spinnerTemplate = '
';
- this.$get = ['$document', '$timeout', '$animate', '$rootScope', function ($document, $timeout, $animate, $rootScope) {
+ this.$get = ['$document', '$timeout', '$injector', '$rootScope', function ($document, $timeout, $injector, $rootScope) {
var $parentSelector = this.parentSelector,
loadingBarContainer = angular.element(''),
@@ -183,6 +183,7 @@ angular.module('cfp.loadingBar', [])
* Inserts the loading bar element into the dom, and sets it to 2%
*/
function _start() {
+ var $animate = $injector.get('$animate');
var $parent = $document.find($parentSelector);
$timeout.cancel(completeTimeout);
@@ -267,6 +268,7 @@ angular.module('cfp.loadingBar', [])
}
function _complete() {
+ var $animate = $injector.get('$animate');
$rootScope.$broadcast('cfpLoadingBar:completed');
_set(1);
diff --git a/build/loading-bar.min.js b/build/loading-bar.min.js
index 75dee12..1aeb24f 100644
--- a/build/loading-bar.min.js
+++ b/build/loading-bar.min.js
@@ -4,4 +4,4 @@
* Copyright (c) 2014 Wes Cruver
* License: MIT
*/
-!function(){"use strict";angular.module("angular-loading-bar",["cfp.loadingBarInterceptor"]),angular.module("chieffancypants.loadingBar",["cfp.loadingBarInterceptor"]),angular.module("cfp.loadingBarInterceptor",["cfp.loadingBar"]).config(["$httpProvider",function(a){var b=["$q","$cacheFactory","$timeout","$rootScope","cfpLoadingBar",function(b,c,d,e,f){function g(){d.cancel(i),f.complete(),k=0,j=0}function h(b){var d,e=c.get("$http"),f=a.defaults;!b.cache&&!f.cache||b.cache===!1||"GET"!==b.method&&"JSONP"!==b.method||(d=angular.isObject(b.cache)?b.cache:angular.isObject(f.cache)?f.cache:e);var g=void 0!==d?void 0!==d.get(b.url):!1;return void 0!==b.cached&&g!==b.cached?b.cached:(b.cached=g,g)}var i,j=0,k=0,l=f.latencyThreshold;return{request:function(a){return a.ignoreLoadingBar||h(a)||(e.$broadcast("cfpLoadingBar:loading",{url:a.url}),0===j&&(i=d(function(){f.start()},l)),j++,f.set(k/j)),a},response:function(a){return a.config.ignoreLoadingBar||h(a.config)||(k++,e.$broadcast("cfpLoadingBar:loaded",{url:a.config.url}),k>=j?g():f.set(k/j)),a},responseError:function(a){return a.config.ignoreLoadingBar||h(a.config)||(k++,e.$broadcast("cfpLoadingBar:loaded",{url:a.config.url}),k>=j?g():f.set(k/j)),b.reject(a)}}}];a.interceptors.push(b)}]),angular.module("cfp.loadingBar",[]).provider("cfpLoadingBar",function(){this.includeSpinner=!0,this.includeBar=!0,this.latencyThreshold=100,this.startSize=.02,this.parentSelector="body",this.spinnerTemplate='',this.$get=["$document","$timeout","$animate","$rootScope",function(a,b,c,d){function e(){var e=a.find(l);b.cancel(k),p||(d.$broadcast("cfpLoadingBar:started"),p=!0,s&&c.enter(m,e),r&&c.enter(o,e),f(t))}function f(a){if(p){var c=100*a+"%";n.css("width",c),q=a,b.cancel(j),j=b(function(){g()},250)}}function g(){if(!(h()>=1)){var a=0,b=h();a=b>=0&&.25>b?(3*Math.random()+3)/100:b>=.25&&.65>b?3*Math.random()/100:b>=.65&&.9>b?2*Math.random()/100:b>=.9&&.99>b?.005:0;var c=h()+a;f(c)}}function h(){return q}function i(){d.$broadcast("cfpLoadingBar:completed"),f(1),b.cancel(k),k=b(function(){c.leave(m,function(){q=0,p=!1}),c.leave(o)},500)}var j,k,l=this.parentSelector,m=angular.element(''),n=m.find("div").eq(0),o=angular.element(this.spinnerTemplate),p=!1,q=0,r=this.includeSpinner,s=this.includeBar,t=this.startSize;return{start:e,set:f,status:h,inc:g,complete:i,includeSpinner:this.includeSpinner,latencyThreshold:this.latencyThreshold,parentSelector:this.parentSelector,startSize:this.startSize}}]})}();
\ No newline at end of file
+!function(){"use strict";angular.module("angular-loading-bar",["cfp.loadingBarInterceptor"]),angular.module("chieffancypants.loadingBar",["cfp.loadingBarInterceptor"]),angular.module("cfp.loadingBarInterceptor",["cfp.loadingBar"]).config(["$httpProvider",function(a){var b=["$q","$cacheFactory","$timeout","$rootScope","cfpLoadingBar",function(b,c,d,e,f){function g(){d.cancel(i),f.complete(),k=0,j=0}function h(b){var d,e=c.get("$http"),f=a.defaults;!b.cache&&!f.cache||b.cache===!1||"GET"!==b.method&&"JSONP"!==b.method||(d=angular.isObject(b.cache)?b.cache:angular.isObject(f.cache)?f.cache:e);var g=void 0!==d?void 0!==d.get(b.url):!1;return void 0!==b.cached&&g!==b.cached?b.cached:(b.cached=g,g)}var i,j=0,k=0,l=f.latencyThreshold;return{request:function(a){return a.ignoreLoadingBar||h(a)||(e.$broadcast("cfpLoadingBar:loading",{url:a.url}),0===j&&(i=d(function(){f.start()},l)),j++,f.set(k/j)),a},response:function(a){return a.config.ignoreLoadingBar||h(a.config)||(k++,e.$broadcast("cfpLoadingBar:loaded",{url:a.config.url}),k>=j?g():f.set(k/j)),a},responseError:function(a){return a.config.ignoreLoadingBar||h(a.config)||(k++,e.$broadcast("cfpLoadingBar:loaded",{url:a.config.url}),k>=j?g():f.set(k/j)),b.reject(a)}}}];a.interceptors.push(b)}]),angular.module("cfp.loadingBar",[]).provider("cfpLoadingBar",function(){this.includeSpinner=!0,this.includeBar=!0,this.latencyThreshold=100,this.startSize=.02,this.parentSelector="body",this.spinnerTemplate='',this.$get=["$document","$timeout","$injector","$rootScope",function(a,b,c,d){function e(){var e=c.get("$animate"),g=a.find(l);b.cancel(k),p||(d.$broadcast("cfpLoadingBar:started"),p=!0,s&&e.enter(m,g),r&&e.enter(o,g),f(t))}function f(a){if(p){var c=100*a+"%";n.css("width",c),q=a,b.cancel(j),j=b(function(){g()},250)}}function g(){if(!(h()>=1)){var a=0,b=h();a=b>=0&&.25>b?(3*Math.random()+3)/100:b>=.25&&.65>b?3*Math.random()/100:b>=.65&&.9>b?2*Math.random()/100:b>=.9&&.99>b?.005:0;var c=h()+a;f(c)}}function h(){return q}function i(){var a=c.get("$animate");d.$broadcast("cfpLoadingBar:completed"),f(1),b.cancel(k),k=b(function(){a.leave(m,function(){q=0,p=!1}),a.leave(o)},500)}var j,k,l=this.parentSelector,m=angular.element(''),n=m.find("div").eq(0),o=angular.element(this.spinnerTemplate),p=!1,q=0,r=this.includeSpinner,s=this.includeBar,t=this.startSize;return{start:e,set:f,status:h,inc:g,complete:i,includeSpinner:this.includeSpinner,latencyThreshold:this.latencyThreshold,parentSelector:this.parentSelector,startSize:this.startSize}}]})}();
\ No newline at end of file
diff --git a/src/loading-bar.js b/src/loading-bar.js
index 9f9450a..d3dc3b2 100644
--- a/src/loading-bar.js
+++ b/src/loading-bar.js
@@ -157,7 +157,7 @@ angular.module('cfp.loadingBar', [])
this.parentSelector = 'body';
this.spinnerTemplate = '';
- this.$get = ['$document', '$timeout', '$animate', '$rootScope', function ($document, $timeout, $animate, $rootScope) {
+ this.$get = ['$document', '$timeout', '$injector', '$rootScope', function ($document, $timeout, $injector, $rootScope) {
var $parentSelector = this.parentSelector,
loadingBarContainer = angular.element(''),
@@ -177,6 +177,7 @@ angular.module('cfp.loadingBar', [])
* Inserts the loading bar element into the dom, and sets it to 2%
*/
function _start() {
+ var $animate = $injector.get('$animate');
var $parent = $document.find($parentSelector);
$timeout.cancel(completeTimeout);
@@ -261,6 +262,7 @@ angular.module('cfp.loadingBar', [])
}
function _complete() {
+ var $animate = $injector.get('$animate');
$rootScope.$broadcast('cfpLoadingBar:completed');
_set(1);