mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
amend(loading): simpler/more clean fix for #1914
This commit is contained in:
9
js/angular/service/loading.js
vendored
9
js/angular/service/loading.js
vendored
@@ -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');
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user