mardi 23 mai 2017

Add parent hierarchy recursively to Ember Object

I'd like to add parent properties recursively to an Ember Object. Something like...

var ParentMixin = Ember.Mixin.create({ /* Not sure what would go here */ });
var EmberObjectWithParentMixin = Ember.Object.extend(ParentMixin, {});
var obj = EmberObjectWithParentMixin.create({
  prop1: {
    prop2: {}
  }
});

So then the behavior I'm looking for is...

obj.prop1.prop2.parent === obj.prop1

I'm open to solutions that do not involve a mixin, that's just where my head is going at this point.




Aucun commentaire:

Enregistrer un commentaire