我嘗試從http://www.eyecon.ro/bootstrap-colorpicker/
換一個ColorPicker組件我需要填寫模板的「背景色CSS屬性」與視圖的「值」屬性... 我試圖設置{{價值}},但它不工作...EmberJs:組件模板
任何意見?
的JavaScript:
App.ColorPicker = Em.View.extend({
classNames: 'input-append color',
attributeBindings: ['name', 'value'],
value: '',
template: Ember.Handlebars.compile('{{view Ember.TextField valueBinding="this.value"}}<span class="add-on"><i style="background-color: {{value}}"></i></span>'),
didInsertElement: function() {
$('#backgroundColor').colorpicker({format: "rgb"});
}
})
;
HTML:
{{view App.ColorPicker placeholder="Background color" name="backgroundColor" valueBinding="App.controller" classNames="input-large" id="backgroundColor"}}
嘗試=的ValueBinding 「view.value」,而不是 「THIS.VALUE」 –
隨着view.value我有以下結果:<我的風格=「背景-color:< script id ='metamorph-0-start'type ='text/x-placeholder'> </script > rgb(255,30,0)< script id ='metamorph-0-end'type =' text/x-placeholder'> </script >「> – fvisticot
你可以發佈一個小提琴什麼的,因爲這很難調試! –