I'm starting a test here, but it's a very strange error.
This source below is giving error "Cannot create property 'id' on number '7'" .
Can anyone tell me what I did wrong?
import Model from '../../lib/Core/data/Model.js';
import Store from '../../lib/Core/data/Store.js';
let myData = new Store({
fields : [
'type'
],
data : [
{ id : 1, name : 'pizza', type : 'food' },
{ id : 2, name : 'bacon', type : 'food' },
{ id : 3, name : 'egg', type : 'food' },
{ id : 4, name : 'Gin tonic', type : 'drinks' },
{ id : 5, name : 'Wine', type : 'drinks' },
{ id : 6, name : 'Beer', type : 'drinks' }
]
});
class MyModel extends Model {
static get fields() {
return [
{ name: "id", type: "string" },
{ name: "food", type: "model" }
];
}
}
let myValue = new MyModel(
//{id: 25, Food: myData.records[3]}
);
let myData2 = new Store({data: myValue});