我的淘汰赛绑定没有更新。我有一个设置为的字段
this.firstName = ko.observable("Bert");
当我打电话时:
AppViewModel.firstName(name);
我需要它来更新。这是一个jsfiddle:
function AppViewModel() {
this.firstName = ko.observable("Bert");
this.lastName = ko.observable("Bertington");
}
// Activates knockout.js
ko.applyBindings(new AppViewModel());
// When I click button I want the name to change
$('input[type=button]').click( function() {
var name = 'New Name';
AppViewModel.firstName(name);
});