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 () {
        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)

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

1 Like