mardi 16 février 2016

Ember Model: Nested Default Value

How can I set default values for nested fields? In my example below, the children field is in an object, which is in an array called options. In my model, how do I set a default value for children? Thanks for any help!

Data:

attributes: {
    'name-unique': 'chem_elem',
    options: [{
        text: 'C',
        value: 'C',
        children: null
    }, {
        text: 'Mn',
        value: 'MN',
        children: null
    }]
}

Model:

export default DS.Model.extend({
    nameUnique: DS.attr(),
    options: DS.attr()
});




Aucun commentaire:

Enregistrer un commentaire