Accessing parent controller when rendering nested templates

HI!

I’m building a trello clone to learn ember and have small problem.

I have a board/index.hbs template which just do {{render 'swimlanes/index' swimlanes}} which renders the different lists of cards. swimlanes/index.hbs renders its cards (using #each) and then {{render 'cards/new'}} to display a simple form to create a new card. So, in my cards/new controller, in my createCard action, can I get the new card’s swimlane somehow?

I tried to just use needs: ['swimlane'] and then use this.get('controllers.swimlane').get('model'). But it is undefined.

I can get to the current board using needs: ['board'] but it does not work with the swimlane so I guess it is due to how I render stuff.

Any ideas?

Given that cards/new is rendered within your swimlane/index controller/template, you should be able to access swimlane/index from cards/new via the parentController property.