Skip to content

Commit

Permalink
amend(loading): simpler/more clean fix for #1914
Browse files Browse the repository at this point in the history
  • Loading branch information
perrygovier committed Aug 20, 2014
1 parent 120f99e commit 25ee658
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
9 changes: 3 additions & 6 deletions js/angular/service/loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function($ionicLoadingConfig, $document, $ionicTemplateLoader, $ionicBackdrop, $
self.element.addClass('visible');
ionic.requestAnimationFrame(function() {
self.isShown && self.element.addClass('active');
$document[0].body.classList.add('loading-active');
self.isShown && $document[0].body.classList.add('loading-active');
});
}
});
Expand All @@ -158,11 +158,8 @@ function($ionicLoadingConfig, $document, $ionicTemplateLoader, $ionicBackdrop, $
$ionicBackdrop.release();
$ionicBackdrop.getElement().removeClass('backdrop-loading');
}
// wrapping in a timeout to make process asyncronous
$timeout(function(){
self.element.removeClass('active');
$document[0].body.classList.remove('loading-active');
}, 10);
self.element.removeClass('active');
$document[0].body.classList.remove('loading-active');
setTimeout(function() {
!self.isShown && self.element.removeClass('visible');
}, 200);
Expand Down
1 change: 0 additions & 1 deletion test/unit/angular/service/loading.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ describe('$ionicLoading service', function() {
$timeout.flush();
expect(angular.element(document.body).hasClass('loading-active')).toBe(true);
loader.hide();
$timeout.flush();
expect(angular.element(document.body).hasClass('loading-active')).toBe(false);
}));

Expand Down

0 comments on commit 25ee658

Please sign in to comment.