mercredi 24 juin 2015

"setProperties" does not pass "attrs" as expected

I have a wrapping component, which yields some other component in itself. (Think about form control group or a table cell component).

To make it as flexible as possible I pass attrs to the hash property. And all component will set hash on itself.

Ember.Component.reopen({
  init: function(){
    this._super();
    this.setProperties(this.get('hash'));
  }
});

http://ift.tt/1LlNwes

It works fine with Strings but not with objects. In my-wrapper component attrs.model.name has the correct value (see the template), but after attrs is passed to the property hash and set by setProperties it is transformed to MutStream. (see console.log)

Why does this transformation happens? Is this the expected behavior? Is my approach considered as an anti-pattern? Is there a workaround? What does MutStream or MUTABLE_REFERENCE mean?




Aucun commentaire:

Enregistrer un commentaire