I started with the Ionic ( ionic start myApp sidemenu) demo application , and added resolveto one of the views :
resolve: {
issue: function($q, $timeout) {
var defer = $q.defer();
$timeout(defer.reject);
return defer.promise;
}
}
I track rejected resolvehere:
.run(function($ionicPlatform, $rootScope, $ionicLoading) {
$ionicPlatform.ready(function() {
$rootScope.$on('$stateChangeError', function() {
$ionicLoading.show({
template: 'All good!'
});
});
});
});
For some reason, if it is resolveimmediately rejected (see defer.reject()above), the callback $stateChangeErrordoes not start. If I do the same, but outside of Ionic, it works!
In addition, attempting to defer rejection resolveby performing $timeout(defer.reject);leads to different behavior. Now it works in the browser as expected, but still does not work on the device. Trying to delay even more leads to success on the device:
$timeout(function() {
defer.reject();
}, 250);
Can anyone shed some light on this?
,