2

How to redirect same path of different routes ?

As per below code, It will call the resolve method when route is '/auth/:token'. How I can modify the below code to call the resolve also when route is '/auth/:token/abc' or '/auth/:token/abc/bcd' or '/auth/:token/abc/dvf/ghj'.

Is there any way to implement this ? (I don't want to create multiple states or route for this)

.state "app.link_login",
   url: "/auth/:token"
   template: "<ui-view/>"
   resolve:
     authRedirect: ($state, $rootScope, $stateParams, TalentAuth)->
       talentAuth = new TalentAuth
       talentAuth.signViaToken($stateParams).then((data)->
         $rootScope.$emit 'auth:login-success'
         $state.go('app.inside.jobapps.overview')
       ,(error) ->
         $state.go('app.signIn')
       )
Shubham
  • 1,163
  • 2
  • 12
  • 36

1 Answers1

0

You use params:

https://github.com/angular-ui/ui-router/wiki/URL-Routing

.state('site.link', {
    url: '/{link}'
    ..
}

so when you use the same state like this

$state.go('site.link', {link: 'link1'}) $state.go('site.link', {link: 'link2'})

Answer Courtesy - https://stackoverflow.com/a/28139092/7007727

Hope this helps

Piyush
  • 81
  • 5