I am trying to define a computed property that depends upon a set of properties, which are specified as an array. The example is given in this fiddle:
var MyObject = Ember.Object.extend({
properties: ['red', 'blue'],
red: 'i am red',
blue: 'blue am i',
defineMagic: function () {
var thiz = this;
Ember.defineProperty(thiz, 'magic', Ember.computed(function () {
console.log('i am called');
return thiz.getProperties(thiz.get('properties'));
}).property(thiz.get('properties').toString()/*what goes here */));
}
});
So far, I have used Ember's defineProperty method to define a computed property. But the computed property does not get recomputed if the underlying properties change, as noted in the comments in the fiddle. Be sure to activate console, as I am trying to validate against the console output.
Is this possible at all in Ember, and if so; how to use it?