I have a view that i want to use twice but with different values.
{{#view App.ColorPickerView sytleName="Background Color" css="bgColor"}}
{{view.sytleName}}
{{/view}}
{{#view App.ColorPickerView sytleName="Text Color" css="textColor"}}
{{view.sytleName}}
{{/view}}
This should be easy.
Please see this jsfiddle http://jsfiddle.net/rmossuk/LUEUV/11/
Basically when you click on Background Color it should change the background color but it is changing the text color as it seems to be using the next instance of the view.
Anyone help me with this ?
Thank you
Rick
The answer is very simple, in the didInsertElement, you declare the view as global, so when instanciating the second ColorPicker, the
viewinonChangemethod of the first color picker refers to the second view.Declaring view with
var view = this;makes the code work.