The problem is as old as the link-to
helper: If one needs to add a class based on wether the link is active or not on the parent element of that link instead of the link element itself, it is necessary to fiddle with the view hierarchy of ember and eventually use private APIs.
Are there plans to improve that? It has gotten quite silent about this here? I can think of several approaches:
- Use mutable bindings, i.e.
{{link-to model active=foo}}
and then in the parent component:classNameBindings: ["active:foo"]
- Use ddau to update the property
- Provide an easy way to check if one is at the route for a certain model and then simply:
classNameBindings: ["active"],
active: computed("model", function() {
return this.isAtRouteFor(model);
})