尝试使用 Knockout 设置可观察对象的可观察属性时遇到问题。有错误的行已用错误注释。我做错了什么,我该如何设置该值?
function Event() {
"use strict";
var self = this;
self.timelineId = ko.observable();
}
function TimelineViewModel() {
"use strict";
var self = this;
self.editedEvent = ko.observable(new Event());
}
$(document).ready(function () {
var timelineViewModel = new TimelineViewModel();
ko.applyBindings(timelineViewModel);
timelineViewModel.editedEvent.timelineId(0); //Error: TypeError: timelineViewModel.editedEvent.timelineId is not a function
});