1

How can I convert current URL to the corresponding state? The result state will be used for state transition using $state.go.

Example: http://localhost/auth/enterprise/

Registered route:

{
"stateName": "auth.context",
"url": ":context"
}

Result: auth/enterprise/ => auth.context

Example: http://localhost/auth/enterprise/esdrubal

Registered route:

{
"stateName": "auth.context",
"url": ":context/:username"
}

Result: auth/enterprise/esdrubal => auth.context

2
  • what are you trying to achieve? some sort of callback URL for Authentication?e.g. for OAuth ? In that case no client-side JS is able to do this Commented Nov 4, 2015 at 11:59
  • What I'm trying to do is convert current URL to a registered state, and use that state on $state.go to proceed the transition. Commented Nov 4, 2015 at 12:05

1 Answer 1

0

SOLUTION:

You can expose the internal state implementation by using the .decorator hook on $stateProvider. You can decorate any property of the state builder; I chose 'parent' arbitrarily.

https://stackoverflow.com/a/30926025/5485700

Sign up to request clarification or add additional context in comments.

Comments