I’m creating this component here that requires me to set “needs” and some computed aliases dynamically:
Spark.SubmitFormComponent = Ember.Component.extend({
setup : function() {
var type = this.get("type");
this.setProperties({
needs : [type+"List", type],
fields : Ember.computed.alias("controllers."+type+"List.fields"),
layouts: Ember.computed.alias("controllers."+type+"List.layouts"),
isEditing: Ember.computed.alias("controllers."+type+".isEditing"),
data : Ember.computed.alias("controllers."+type+".model")
});
}.on("init"),
})
Now when I call get on one of these properties this.get("fields") I get a ComputedProperty object instead of the value of the controller I’m trying to reference. Is this the expected behaviour and if so how can I get the value I want?
var obj = Ember.Object.create();
obj.set('a', 'yay'); // your initial property
Ember.defineProperty(obj, 'b', Ember.computed.alias('a')); // your alias
obj.get('b'); // => "yay"