lundi 2 mars 2015

Ember set Component property in controller

I have a Component, whose property I want to set in a Controller. I seem to be having problems using the computed alias to set it. Please see code below.


My Component is as follows:



TM.MyModalComponent = Ember.Component.extend({
totalWidth: '200px',
widthStyle: function() {
console.log(this.get('totalWidth'));
return 'width:'+this.get('totalWidth');
}.property('totalWidth'),
});


I am trying to set the property totalWidth in a parent controller as follows:



modalWidth:Ember.computed.alias("myModalComponent.totalWidth"),
this.set("modalWidth",'100px');


It returns a undefined value when I try to console log it and errors with

Property set failed: object in path "myModalComponent" could not be found or was destroyed.


Any help will be much appreciated.


Thanks, Lakshmi





Aucun commentaire:

Enregistrer un commentaire