0

看看这个使用淘汰赛和主干的小提琴,这些库是自动导入的吗?

骨干和淘汰赛小提琴

Code here : 

Name: <input data-bind="value: name" type="text"/><br>
Age: <input data-bind="value: age" type="text"/><br>
Evil: <input type="checkbox" data-bind="checked: evil" /><br>

<button id="foo">Change Model!</button>

// create a plain old backbone model
var backboneModel = new Backbone.Model({
    name: "Montgomery Burns",
    age: 102,
    evil: true
});

// use knockback.js to bridge knockout data-binding with backbone models
// read_only is set to false to make the binding two-way.
// note the use of the "kb" api for knockback.
var viewModel = kb.viewModel(backboneModel, {
    read_only: false
});

// at this point, knockback has given us a viewModel which is compatible
// with the normal knockout api.  so we can use the "ko" api now.
ko.applyBindings(viewModel);

$("#foo").click(function() {
    backboneModel.set ({
        "name": "Lisa Simpson",
        "age": 8,
        "evil": false
    });
});
4

1 回答 1

1

小提琴的作者使用左侧边栏中的管理资源功能将它们包含在内。

于 2013-01-27T21:54:22.100 回答