Skip to content

Commit 25ee658

Browse files
committed
amend(loading): simpler/more clean fix for #1914
1 parent 120f99e commit 25ee658

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

js/angular/service/loading.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function($ionicLoadingConfig, $document, $ionicTemplateLoader, $ionicBackdrop, $
145145
self.element.addClass('visible');
146146
ionic.requestAnimationFrame(function() {
147147
self.isShown && self.element.addClass('active');
148-
$document[0].body.classList.add('loading-active');
148+
self.isShown && $document[0].body.classList.add('loading-active');
149149
});
150150
}
151151
});
@@ -158,11 +158,8 @@ function($ionicLoadingConfig, $document, $ionicTemplateLoader, $ionicBackdrop, $
158158
$ionicBackdrop.release();
159159
$ionicBackdrop.getElement().removeClass('backdrop-loading');
160160
}
161-
// wrapping in a timeout to make process asyncronous
162-
$timeout(function(){
163-
self.element.removeClass('active');
164-
$document[0].body.classList.remove('loading-active');
165-
}, 10);
161+
self.element.removeClass('active');
162+
$document[0].body.classList.remove('loading-active');
166163
setTimeout(function() {
167164
!self.isShown && self.element.removeClass('visible');
168165
}, 200);

test/unit/angular/service/loading.unit.js

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ describe('$ionicLoading service', function() {
8989
$timeout.flush();
9090
expect(angular.element(document.body).hasClass('loading-active')).toBe(true);
9191
loader.hide();
92-
$timeout.flush();
9392
expect(angular.element(document.body).hasClass('loading-active')).toBe(false);
9493
}));
9594

0 commit comments

Comments
 (0)