vendredi 4 septembre 2015

Ember: Ember Data results into components

On my route im requesting via ember-data some records. Lets say the model-type is 'item'.

model: function(){
    return this.get('store').find('item');
}

now ive got a component named 'my-foo' which should use the records to do something with the data. Therefore Im calling the component like that:

{{my-foo myItems=model}}

in my routes template. In the components js part, Im trying to get the myItems-field and iterate over them.

this.get('myItems').forEach(...);

Unfortunalety its not clear for me if the model i want to overgive to the component is an collection from records or just a single record (since on some routes the model is the result of store.find('item') on other store.find('item', 23424).

How can I check what kind of data arrives in the component.

(Also Im wondering what kind of object is it since im using ember-data. Is it a DS.recordarray or a promise or something else at this time?)




Aucun commentaire:

Enregistrer un commentaire