Open Ludevik opened 10 years ago
+1
+1
+1
+2 A large majority of apps are moving toward using resolves via router. Would love to be able to include this option with angular-busy
Is the use-case to just show a spinner during route loads? If so, you could use the $stateChangeStart/Success/Error events. Something like:
var defer;
$rootScope.$on('$stateChangeStart',function(){
defer = $q.defer();
$rootScope.busyPromise = defer.promise;
});
$rootScope.$on('$stateChangeSuccess', function(){
defer.resolve();
});
$rootScope.$on('$stateChangeError', function(){
defer.reject();
});
Thanks @cgross that works great for me.
Hello, i was using older version of angular-busy which had a dependency on angular-promise-tracker. Older version integrated nicely with angular-ui-router's resolve functionality. I just added the tracker to $http option object and that was it. Every request was tracked and busy div popped up.
The question is how to use the new version with angular-ui-router resolve. New version tracks promises added to the $scope, but as i am using ui-router's resolve functionality, resolved promises are injected to my controller. I am not creating any promises in my controller, so i cannot add them to $scope.
Thanks L