Im trying to block user from going to some route if he doesnt have payment
method. this is the code:
resolve: {
hasPayment: ['userService', 'paymentsService','$q', function(
userService,paymentsService, $q ) {
if(userService.oAuth) {
paymentsService.getPayments().then(function(res) {
if(res.data.data.length) return
$q.reject({hasPayment:false});
});
}
}]
}
$rootScope.$on('$stateChangeError', function(event, toState,toParams,
fromState, fromParams, error) {
console.log(error);
})
but its not get the error if the condition true, why?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.