Ah gotcha, thanks! I haven’t been looking at ember-cli as i’m using Ember within Rails and using the Rail’s asset pipeline/guard. But I’ll take a deeper look now.
@SelvaG Actually we can use the combination of model
and setupController
hooks to gain benefits from both.
Thank you for your tips. This works for me only with one render. When I add second render it throws error
Error: You can only use the {{render}} helper once without a model object as its second argument
The code is
App.DashboardIndexRoute = Ember.Route.extend
setupController: (controller, model) ->
this.controllerFor('dashboard.users').set 'promise', @store.find('user')
this.controllerFor('dashboard.tooltips').set 'promise', @store.find('user')
App.DashboardUsersController = Ember.ArrayController.extend Ember.PromiseProxyMixin, { }
<div>
{{render 'dashboard/tooltips' users }}
{{render 'dashboard/users' users}}
</div>
Do you have guys any idea why?
I think you can just use render
without arguments. Because you’ve set the promise
for controller in setupController
which means the model
property will be set when the promise is resolved. Try this:
{{render 'dashboard/tooltips'}}
{{render 'dashboard/users'}}
I like what I see here. I had really struggled the best way to do something like this. Perhaps it’s common knowledge now, and I missed out, or overlooked any resources that outlined this.
I put together a JSBin that demonstrates what is discussed in this read by utilizing this.controllerFor
in the setupController
hook, and then in the template it renders a list of favorite colors twice by making use of both a named outlet
and render
to render the the same template.
I guess my question would be, which is better to use in this case? Should it be render
or a named outlet
? Any advice is much appreciated.
You can view the JSBin here: http://emberjs.jsbin.com/tetici/14/edit?html,js,output
Since {{render}}
is going away, I’d suggest using named outlets.
Error while processing route: “home” promise.then is not a function TypeError: promise.then is not a function
I did the exact same things. Do you have any idea?