Search code examples
ember.jsember-cli

Link to a child route but have active class on parent route


I have a navbar item

{{#link-to 'customer'}}

When clicked I want it to route to customer.details route. I can currently achieve this by having the customer route redirect to customer.details. However, when within the customer.details the route, if I click the link-to in the nav it transitions to the customer route instead of sending it to customer.details. None of the route functions like redirect, activate, or before/after model, fire when transitioning up to a route chain.

The other option of

{{#link-to 'customer.details'}}

would mean that any other customer.routename would not inherit the active class.

Am I missing something? Thanks.


Solution

  • So a redactor KerrickLong helped me out with this:


    Try having the redirect to customer.details live on the customer.index route instead of directly on the customer route.

    Works perfectly!