我正在使用knockoutjs将数据绑定到表,我想在用户点击时更新对象。这是我的代码
var Books = [{Book:"Harry Potter",Author:"J.K rowling"},{Book:"5 Point Someone",Author:"Chetan Bhagat"},{Book:"I too had a love story",Author:"Ravinder Singh"}];
var appViewModel = function() {
this.firstName = ko.observable("Amit");
this.Books = ko.observableArray([]);
this.Books(Books);
this.updateBook = function() {
this.Book("Harry Potter and Prisoner of Azkaban");
}
};
ko.applyBindings(appViewModel);
但它得到错误:“未捕获TypeError:字符串不是函数”。怎么解决它?