Accessing the controller properties inside the route

Say there’s a ‘test’ route. I’m rendering three templates (A, B, C) using renderTemplate hook, each of which has a corresponding controller (A, B,C). There are some properties that are defined in the controllers of A,B,C. How do I access these controller properties from the test route ? I’m just trying to modify the values of the controller properties of the templates in the route.

I’d be curious why you have one route rendering 3 different templates each having their own controller. In my experience, 3 distinct route templates with corresponding controller + route plays more nicely. What is the primary problem you are trying to solve here? Some context may present better idiomatic solutions. That said, I like the setupController in route’s for when you need to initialize properties on the controller or cross the bridge between the two.

Say for example, you need to display a list of post, a post that is opened, and the comments for that post all in the same route. So, the Post list, the post itself and the comments are all a different templates with their own controllers. Hence, I need to use the renderTemplate hook to display all these three in a single route. My question was how to access the template’s property from the route. @efx

I think that adds a bit of context. I think you could consider making these components. By breaking it up into components you probably will find it easier to access the properties you need. Are you able to create a twiddle demonstrating what you are trying to accomplish? https://ember-twiddle.com/

Hmm, I think I may not understand the question. What do you mean by “template’s property”?

Yeah I did change them to different components with their own controllers. But I don’t want to use controllerFor to fetch and get the entire controller properties.

I’m gonna use a closure function and define it in the route. We can pass a parameter, instead of using the sendAction from the component. This avoids a lot of the boiler plate code.