I have email verification state defined as below, which redirects the state to account if the user is logged in and otherwise it opens up, but the thing is with dynamic params of verification url.
$stateProvider
.state('verification', {
url: '/verification/:email/:token',
templateUrl: 'verification/verification.tpl.html',
controller: 'VerificationCtrl',
title: 'Verification',
resolve: {
UnauthenticatedUser: ['$q', '$state', 'securityAuthorization', function($q, $state, securityAuthorization){
var promise = securityAuthorization.requireUnauthenticatedUser()
.catch(function(){
// user is authenticated, redirect
$state.go('account.dashboard');
return $q.reject();
});
return promise;
}]
}
});
In this case it should redirect to account.dashboard(/account/dashboard), but it bounce back to this url(/verification/:email/:token) after that.
But if I put the url as /verification
only then it works normally the way it is supposed to and redirect to account.dashboard.
Can someone suggest where I am going wrong