mardi 16 juin 2015

filling data to the ember controller without router

I try fill ember controller without setupController hook, like this:

Ember.$.getJSON('http://url.com').then(function (response) {
 self.store.pushPayload('record', response);
 self.get('controllers.consultation').set('model', self.store.push('consultation', response.consultation));
});

Model for controller consultation contain hasMany field records

 export default DS.Model.extend({
        records: DS.hasMany('record', { async: true }),
        ....
    });

When I call controller.records in templates it's doesn't works (empty), but other fields works fine.

Question: why controller.records empty?

NOTE: When I create field in consultation controller which contain consultation object it's works.

self.get('controllers.consultation').set('controllerObj', self.get('controllers.consultation').set('model', self.store.push('consultation', response.consultation)));  

Aucun commentaire:

Enregistrer un commentaire