Route not triggering with {{render}} helper


#1

It is very possible that I’m doing this completely wrong or in a way that is not intended, but here is what I’m trying to accomplish:

I have some data that gets returned and is the model for my index route. This data is an array. For each item in the array, I need to render out a template that has its own model. Right now, I have these routes / templates stored in the following manner:

widgets/<widgetName>

So for a widget, let’s call it “general”, I will have the following:

app/routes/widgets:

general.js

app/templates/widgets:

general.js

In the general route, I am returning a model (retrieved via ember-data).

My problem: this route is never being hit. In my index.hbs page, I have tried:

{{render "widgets/general"}}

The template is rendered out, but there is not model backing and the route is never triggered.

Am I doing something wrong? Is a behavior like this even supported or is there a different method I should be using?

Any guidance would be appreciated.


#2

The routes are only triggered when the url changes. If you use the render helper you should pass the model in e.g.

{{render "widgets/general" model}}

As you’re talking about widgets though I suspect you should be use a component instead of the render helper. http://emberjs.com/guides/components/


#3

Your problem sound a lot like Dashboard type views This thread contains a lot of advice on how to deal with those kind of things.