Skip to content

Commit

Permalink
Merge pull request #101 from gdi2290/patch-1
Browse files Browse the repository at this point in the history
fix(cfpLoadingBar): $animate circular dep in Angular 1.3.0+
  • Loading branch information
chieffancypants committed Sep 4, 2014
2 parents b1f42cd + 0b6ff65 commit b9df827
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/loading-bar.js
Expand Up @@ -157,8 +157,8 @@ angular.module('cfp.loadingBar', [])
this.parentSelector = 'body';
this.spinnerTemplate = '<div id="loading-bar-spinner"><div class="spinner-icon"></div></div>';

this.$get = ['$document', '$timeout', '$animate', '$rootScope', function ($document, $timeout, $animate, $rootScope) {

this.$get = ['$injector', '$document', '$timeout', '$rootScope', function ($injector, $document, $timeout, $rootScope) {
var $animate;
var $parentSelector = this.parentSelector,
loadingBarContainer = angular.element('<div id="loading-bar"><div class="bar"><div class="peg"></div></div></div>'),
loadingBar = loadingBarContainer.find('div').eq(0),
Expand All @@ -177,6 +177,10 @@ angular.module('cfp.loadingBar', [])
* Inserts the loading bar element into the dom, and sets it to 2%
*/
function _start() {
if (!$animate) {
$animate = $injector.get('$animate');
}

var $parent = $document.find($parentSelector);
$timeout.cancel(completeTimeout);

Expand Down Expand Up @@ -261,6 +265,9 @@ angular.module('cfp.loadingBar', [])
}

function _complete() {
if (!$animate) {
$animate = $injector.get('$animate');
}
$rootScope.$broadcast('cfpLoadingBar:completed');
_set(1);

Expand Down

0 comments on commit b9df827

Please sign in to comment.