Set component property to data from store


#1

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)


#2

set items in init this.set('items', items)