vendredi 28 juin 2019

Model properties are not set

I'm trying to get data from a server and set it to Ember's DS.Model (by ember's magic). But records are created with no data.

I have got a model models/product.js:

const { Model } = DS;

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

In routes/product.js I request all products:

    model() {
        return this.store.findAll('product');
    }

The server returns data: https://gyazo.com/ba38b756f334bc22d07fe18ccfddda34

I expect ember to create 3 records with data from the server. But actually, it creates this https://gyazo.com/a9a7b77d838ec33b05e5f81ef8304cdb

What is wrong? I guess I shouldn't specify any adapters and serializers to get default Ember behavior.




Aucun commentaire:

Enregistrer un commentaire