Reputation: 6988
Does Ember expose an API I can use to manually look up a route (as a dot separated path) from a URL?
For example:
Ember.routeForURL('/foo/bar')
Upvotes: 1
Views: 1326
Reputation: 333
There is no public API for that as far as I know. What you can do is use router's recognizer.
let owner = Ember.getOwner(this);
let router = owner.lookup('router:main');
let handlers = router.router.recognizer.recognize('/foo/bar')
"handlers" will contain an array of objects where handler property will be something like this ["application", "foo", "foo.bar"]
And then you can probably use the last handler to do
owner.lookup('route:' + lastHandler)
Upvotes: 2