Scenario
I’m created a re-usable grid component. The grid component needs to be able to render links - internal to the app or external. The simplest way to do this would be for the grid component to look for an href
property in the provided data, letting the parent controller construct the href however it wants to.
Problem
The parent component can’t construct the href
and pass it through because Ember’s link-to
functionality is only available as a HandleBars helper.
Solution
A new API (example for demonstration purposes only):
// Returns '/group/123/person/456/'
Ember.Location.linkTo('group.person', {group: 123, person: 456})
This is conceptually similar to Django’s reverse() method.
I’m pretty new to Ember - I’d love to hear feedback on other ways to address this problem. Thanks!