g13013
g13013

Reputation: 315

setting values of nested objects

I have a simple Ember.Object that has an another Ember.Object as a member

TopObject = Ember.Object.extend({
    subObject: Ember.Object.extend({
        prop: ''
    })
});

The question is, can Ember set values of nested object if I create the object with loaded data like this:

TopObject.create({
    subObject: { prop: 'value'}
});

Upvotes: 1

Views: 755

Answers (1)

selvagsz
selvagsz

Reputation: 3872

If my understanding is correct that you need an object as a property of another object, use Ember.Object.create() for your subObject to create an instance. Now you can go out with your way as TopObject.create({subOject: {prop: 'value'}});

Here is a Little fiddling on your objects

Upvotes: 1

Related Questions