ember.js - model not propagating to controller -
i have model hook in route object looks this:
model: function(params) { // return active filter activities on given date return this.store.filter('activity',function(activity){ var itemdate = new date(activity.get('start_time')); itemdate = moment(itemdate).format('yyyy-mm-dd'); return itemdate === params.on_date; }); }
the route's currentmodel
gets populated ds.filteredrecordarray
appropriate values set reason model never gets passed controller , therefore template's {{#each}} {{/each}}
remains empty.
i created hack set added following route:
setupcontroller: function(controller, model) { controller.set('model',this.get('currentmodel')); }
this works when load controller first time goes infinite loop when transitionto
route. ahh well, hack anyway. know how can working "ember way"?
you need populate content of controller model (the result of filter
function) this:
setupcontroller: function(controller, model) { controller.set('content', model); }
though should default behavior , don't think need explicitly define that.
Comments
Post a Comment