I have a component in which I am observing a property from model and model is fed to controller in controller setup as controller property 'model'. Model has properties age, salary, rank. The property in component is to be entered by user.
The component will be called as:
{{ui-slider prop="age"}}
OR
{{ui-slider prop="salary"}}
This is not the complete component but it explains my problem.. The Component is :
App.UiSliderComponent = Ember.Component.extend({
prop:function(){
return this.get('prop');
}.property('prop'),
modelPropertyObserver:function(){
console.log("property is "+this.get('targetObject.model').get(this.get('prop'));
}.observes('targetObject.model.'+this.get('prop')),
didInsertElement:function(){
console.log("Element inserted");
}
})
This is not working. When I observe property like .observes('targetObject.model.age')
then it works fine.
But now it is showing cori_component.js:29 Uncaught TypeError: this.get is not a function
I also tried .observes('targetObject.model.'+this.prop)
Though it doesn't show any error but the observer doesn't work.
How to concatenate the 'prop' property to the observer?
Or is there any way that I can concatenate the string inside component and then substitute it into observer.