From 90e7395e62f524adba658622ebe0efef2be1f45c Mon Sep 17 00:00:00 2001 From: Andrew Joslin Date: Wed, 14 May 2014 10:48:43 -0600 Subject: [PATCH] fix($ionicLoading): do not flicker when showing long loading messages Closes #1252 --- js/angular/service/loading.js | 1 + js/utils/dom.js | 5 ++++- test/html/loading.html | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/angular/service/loading.js b/js/angular/service/loading.js index 845e776d5dc..6d012ef45c9 100644 --- a/js/angular/service/loading.js +++ b/js/angular/service/loading.js @@ -118,6 +118,7 @@ function($document, $ionicTemplateLoader, $ionicBackdrop, $timeout, $q, $log, $c ionic.DomUtil.centerElementByMarginTwice(self.element[0]); ionic.requestAnimationFrame(function() { self.isShown && self.element.addClass('active'); + ionic.DomUtil.centerElementByMarginTwice(self.element[0]); }); } }); diff --git a/js/utils/dom.js b/js/utils/dom.js index 44cc9f4be05..65b8d6a1cbf 100644 --- a/js/utils/dom.js +++ b/js/utils/dom.js @@ -204,8 +204,11 @@ centerElementByMarginTwice: function(el) { ionic.requestAnimationFrame(function() { ionic.DomUtil.centerElementByMargin(el); - ionic.requestAnimationFrame(function() { + setTimeout(function() { ionic.DomUtil.centerElementByMargin(el); + setTimeout(function() { + ionic.DomUtil.centerElementByMargin(el); + }); }); }); }, diff --git a/test/html/loading.html b/test/html/loading.html index b22d5c0612c..97c3112ed0e 100644 --- a/test/html/loading.html +++ b/test/html/loading.html @@ -18,9 +18,9 @@ .controller('LoadingCtrl', function($scope, $ionicLoading) { $scope.startLoading = function() { $ionicLoading.show({ - template: 'Getting current location...', + template: '
Connection problem.

Please check your internet connection!
', delay: 100, - duration: 500 + duration: 3000 }); }; });