Emberjs是否为复选框提供selectionBinding,以处理选中/选中的复选框选项。

如果是,该怎么办?

最佳答案

绑定(bind)到checkedEmber.Checkbox属性,请参阅http://jsfiddle.net/5pnVg/:

Handlebars :

{{view Ember.Checkbox checkedBinding="App.objController.isChecked" }}

JavaScript :

App.objController = Ember.Object.create({
    isChecked: true,

    _isCheckedChanged: function(){
        var isChecked = this.get('isChecked');
        console.log( 'isChecked changed to %@'.fmt(isChecked) );
    }.observes('isChecked')
});​

关于checkbox - EmberJs中复选框的SelectionBinding,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10383882/

10-11 15:27