$ionicLoading stuck during extensive calculations


#1

Hi, maybe this is a late night issue, but I cannot solve this puzzle by myself. I’ve got a time consuming calculation that takes about 4 secs. I’d want to use the $ionicLoading service to show a spinner during this calculations, but I can’t make this work. I have a code like this:

$scope.showSpinner(); // simple $ionicLoading.show({..}); $scope.extensiveCalculations(); // takes about 4 secs

If I use the above code the $ionicLoading doesn’t even show.

If I call the calculation after some timeout (e.g. 300ms) then the $ionicLoading is visible, starts to spin but immediately stops when the calculation begins.

$scope.showSpinner(); $timeout(function() { ....$scope.extensiveCalculations(); // long calculations }, 300);

Could you please give me a hint how to put the calculation into background so that the spinner spins freely until the job is done? I can make it work with the cordova plugin for spinnderdialog, but I don’t want to use it in that case.

Cheers,
Rafal


#2

It seems that it’s not a $ionicLoading issue. The extensive call blocks the whole view, even animated gif, which probably works on a complete different thread than JS, stops its animation…