1

I am trying to dynamically create a route to my router. I know there is serialize for doing this, but it appears to only accept a finite amount of parameters. For example, I need to be able to build a route that could be /:a or /:a/:b/:c.

My question is, is there a way to get what the original path request was?

I will need to:

  • get the original path
  • pause the router so an ajax call can be made to retrieve path info.
  • request from the server the path and return the module if it exists (I have that much set up).
  • If path exists, create the route and move the application into that state.

1 Answer 1

2

You can access the requested location via the router's location property. You could then split the returned string and access the different parameters.

locationString = App.router.get('location.location.hash')
// something like "/1/2"
params = locationString.split(/\//)
param1 = params[1] // => "1"
param2 = params[2] // => "2"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.