Returning the route on recognize?
gpoitch opened this issue · comments
Is there a good way to get the actual route information back on recognize
? I'd like to just define some metadata and use it after it's recognized:
router.add([{ path: "/posts", component: PostComponent, foo: 'bar' }]);
var result = router.recognize("/posts");
// want: result[0].component, etc
I can tack it onto the handler
api, but it feels a bit sloppy defining and accessing it through that.
We don't intend for route-recognizer
to be a place in which you store data. It is intended only to store handler
s which should be string identifiers. Those string identifiers are things you can use as lookup keys in your own external-to-route-recognizer
registration system. This is how Ember handles it.
This constraint exists in order to support serialization of the router's NFA/radix trie at build time and the consequent performance wins.
Inside of Ember route-recognizer
itself is private API since (to the best of my knowledge) none of its interfaces are reachable without crossing an Ember API first.
I'm closing this as it's not something we wish to change about route-recognizer
.