mardi 23 mai 2017

Accessing model properties in Controller - Ember

So, I'm trying to access my model properties in controller.

Controller:

dashobards: [
{ id: 12, name: 'test' },
{ id: 17, name: 'test2' },
];

In route I have model named dashboards

return Ember.RSVP.hash({
dashboards: this.store.findAll('dashboard'),
}).then((hash) => {
  return Ember.RSVP.hash({
    dashboards: hash.dashboards
  });
}, self);

I wanna have result in controller like this:

dashboards: [
{ id: 12, name: 'test' },
{ id: 17, name: 'test2' },
{ id: 17, name: 'test1' },
{ id: 20, name: 'test20' },
];

In controller I am trying to access this model like this:

this.dashborads = this.get(model.dashobards)

And it's not working, is there any other way of doing that?




Aucun commentaire:

Enregistrer un commentaire