mardi 28 février 2017

Ember Data findAll() causing "TypeError: Cannot read property 'type' of undefined"

Hooking up my 1st model to my backend and am getting the following error when calling Ember Data's findAll()

TypeError: Cannot read property 'type' of undefined

The route,

import Ember from 'ember';

export default Ember.Route.extend({
    model() {
        this.store.findAll('restaurant');
    }
});

The model,

import DS from 'ember-data';

export default DS.Model.extend({
    name: DS.attr()
});

I can see that Ember is hitting my local server and returning properly formatted JSON from the correct url,

{  
    "restaurants": {  
        "id":1,
        "name":"Restaurant Name"
    }
}

I have seen similar questions about this but it usually has to do with improperly formatted JSON.




Aucun commentaire:

Enregistrer un commentaire