我在尝试更新fullcalendar angular2上的事件时遇到错误
ERROR TypeError: Cannot read property 'clone' of undefined
安装Angular2 fullcalendar并声明为CalendarComponent,
<div class="ibox-content" *ngIf="isLoaded">
<angular2-fullcalendar [options]="calendarOptions"></angular2-fullcalendar> </div>
创建了EventObject
let event = {
id: this.editableTask.id,
title: this.editableTask.name,
start: this.editableTask.startDateTime,
end: this.editableTask.planDateTime
}
console.log(event);
console.log输出
id: 6, title: "tes3", start: "2017-10-14T16:55:33", end: "2017-10-15T16:55:33"}
将CalendarComponent用作ViewChild
@ViewChild(CalendarComponent) myCalendar: CalendarComponent;
我为更新事件创建函数
updateEvent(event: any) {
this.myCalendar.fullCalendar('updateEvent', event);
}
当我尝试使用eventObject调用函数时遇到问题:
ERROR TypeError: Cannot read property 'clone' of undefined
at mutateEvent (fullcalendar.js:13769)
at updateEvents (fullcalendar.js:13356)
请有人帮忙解决。
答案 0 :(得分:0)
不幸的是,你无法摆脱这个错误,因为正如我所理解的那样,fullcalendar包裹着updateEvent。尝试使用ng-fullcalendar,调用函数&#39; render&#39;。
npm i ng-fullcalendar