In a project I want to show the Load indicator before I navigate to the next view, to achieve this, I’m trying to use the following code:
$ionicLoading.show({
hideOnStateChange: false,
noBackdrop: true,
templateUrl: 'components/capabilitymap/projectLoader.html'
}).then(function() {
$state.go(stateName, params);
});
Sometimes the loader does show before the $state.go is fired, but sometimes it is not yet shown when this code is called. I’ve tried using the option delay 0, but this didn’t help.
How can I gaurantee that the Loading Indicator is shown before moving on the next page?