Best practices for automatic child route rendering?


#1

In a complex real world scenario an application will contain 3 or 4 nested navigation levels. In this scenario often a special use case occurs: You click on a tab or menu item and the result of this navigational action should not only the display of the related template of this route but should also render the template of a default sub route. This could be implemented by the use of redirect. For me the name redirect sounds more like moving to a complete other direction. Redirect sounds good in the use cases of redirect to a login page or some thing like this. In the scenario I describe above I want automatic expand my navigational path. I have tried this in a small web application: In this application I want that a click of the “Main WhiteBoard” (whiteBoards/1) tab not only show the whiteBoard template but also the whiteBoard/image template. I have that implemented with:

App.WhiteBoardIndexRoute =  Ember.Route.extend({
    redirect: function(){
        this.transitionTo('whiteBoard.image');
    }
});

This navigational step works as expected !

Confusing for me is that a click on the “Private WhiteBoard” tab will not result in a transition to whiteBoards/2/image !!! I can make this transition possible if I click at first on the “Videos” Tab and then on the “Private WhiteBoard” tab.

I think something goes wrong here, but no errors occurs and I have no idea what I can do to make it work.

I have activated a detailed logging of the transitions. In the logs one can see that the redirect results in an abort of a transition but this is not what I would expect if my intension is a automatic extension of my route.

I think redirecting and automatic expansion of sub routes are different use cases. What think you about that ?

What I have to do to fix my navigational problem ?