mercredi 6 novembre 2019

Ember router breaks on redirect to '/'

I'm having a hard time making my router understand that we are on a certain page and it should be displayed in the navigation as active. The situation is as follows:

 this.route('mainRoute', function() {
     this.route('list');
 });

The path we are interested in is /mainRoute. Unfortunately, there are a lot of legacy links that point to /mainRoute/list. The workaround for this was to redirect from the /mainRoute/list component back to the /mainRoute component.

beforeModel() {
   this.replaceWith('/mainRoute');
}

Now, my issue is that the /mainRoute navigation link will never be seen as active. I've tried adding a path for the /mainRoute ('/', '/mainRoute', 'mainRoute'), I've tried transforming it to a resource and a bunch of other things that passed my mind. But it either won't work, or will go in an infinite redirecting loop.

Any thoughts on this? Thanks so much, I really need a solution for this!




Aucun commentaire:

Enregistrer un commentaire