Any way to take a string URL and extract the route parameters from it?


Is there an equivalent of Rails.application.routes.recognize_path in Ember? #recognize_path would take a url and break it down like so:

> Rails.application.routes.recognize_path('/posts/234/this-is-my-post')
=> {:action=>"show", :controller=>"posts", :post_id=>"234", :slug=>"this-is-my-post"}

Is there anything similar to this in Ember?


I’m stuck on Ember 1.4.0 so not sure if this will work, it kinda gives you what you need I think.


Worth looking at is well.


Just to confirm, the above code does still work as of 1.10. Also as an FYI: the route recognizer doesn’t handle anything but the plain Ember path. (e.g. “/posts/123” will work, but “#/posts/123” and “” will not).


Does it differ if I’m using Ember CLI?

I tried App.__container__.lookup('router:main').get('router') but it returns null.


@achan note that because of the way ember cli works with modules there is no global App variable hanging off of window.

You might want to check out this addon if you would like to debug that way.