我尝试从http://www.eyecon.ro/bootstrap-colorpicker/
包装一个 colorPicker 组件
我需要用视图的“值”属性填充模板的“背景颜色 css 属性”......我已尝试设置 {{value}} 但它不起作用...
有什么建议吗?
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"}}