simon
simon

Reputation: 943

How can I get the Ember.Route instance for a given path

I can get the current path using:

App.__container__.lookup('controller:application').get('currentPath')

But then how can I get the Route instance for that path?

Upvotes: 0

Views: 537

Answers (2)

knikolov
knikolov

Reputation: 1800

Or maybe:

App.__container__.lookup("controller:application").get("currentRouteName")

Upvotes: 1

Meori Oransky
Meori Oransky

Reputation: 688

Simple:

var pathName = App.__container__.lookup('controller:application').get('currentPath');
var route = App.__container__.lookup('route:' + pathName);

Upvotes: 1

Related Questions