vendredi 24 juin 2016

Set component property to data from store

Seems it's a bad practice to retrieve data from your component, but this is kind of an experiment (hope the code explains itself)

import Ember from 'ember';

export default Ember.Component.extend({
    store: Ember.inject.service(),
    items: [],
    init () {
        this._super(...arguments);
        var store = this.get('store'); 
        let items =  store.findAll('dealtype');
    }
});

While I can see my api is being hit (debug) and data returned (ember inspector) when looping over "items" in my component template, it's always empty.

Curious what I'm doing wrong (learning still)




Aucun commentaire:

Enregistrer un commentaire