mardi 23 février 2016

Why does the CP in the controller return undefined?

In setupController (in a route). I have:

setupController(controller, model) {
  this._super(...arguments);

  let params = this.paramsFor(this.routeName);

  controller.set('model', model);

  this.store.query('category', { filter: { 'shop-id': params.shop_id } }).then(categories => {
    console.log(categories); // Class {query: Object, store: Class, manager: Class, isLoaded: true, meta: ember$data$lib$system$empty$object$$EmptyObject…}
    controller.set('categories', categories);
  });
}

In a controller, I have:

availableTags: Ember.computed('categories.[]', {
  get() {
    console.log(this.get('categories')); //returns undefined
  }
})

console.log in the controller returns undefined. Ember inspector Network tab shows some results. What am I missing?




Aucun commentaire:

Enregistrer un commentaire