有人可以告诉我为什么这不起作用吗?
function Event() {
self.EventName = ko.observable();
self.EventTypeID = ko.observable();
self.EventTypeName = ko.observable();
self.DepartmentID = ko.observable();
self.DepartmentName = ko.observable();
self.EventDescription = ko.observable();
self.EventDate = ko.observable();
self.EventItems = ko.observableArray([]);
self.MembersAttended = ko.observableArray();
};
self.EventToAdd = new Event();
self.EventToAdd.EventName = 'test';
self.EventToAdd.EventItems.push(new EventItem(4));
我得到那个推送是未定义的。
谢谢!