@FullCalendar:在 Angular 中重新分配事件数组
@FullCalendar: reassign events array in Angular
我在Angular8中使用完整的日历,我给它分配了事件数组,它显示了一个用户的所有事件,
calendarOptions: CalendarOptions = {
initialView: ‘dayGridMonth’,
showNonCurrentDates: false,
fixedWeekCount: false,
events: this.calendarEvents
};
现在我有一个下拉列表,用户可以在其中 select 一个类别,具体取决于我需要分配特定事件数组的用户 select 的值,
我在下面的 if 条件下尝试,
if(this.timeline_val == ‘STTR’){
this.calendarOptions = {
initialView: ‘dayGridMonth’,
showNonCurrentDates: false,
fixedWeekCount: false,
events: this.calendarEvents1
};
但它不会被 events1 值覆盖。添加的新事件列表未反映在日历中。
我什至尝试在 if 条件下将新数组列表重新分配给先前的数组,但它不起作用。
if(this.timeline_val == 'ABC'){
this.calendarEvents = this.calendarEvents2; }
你能帮忙吗?如何在 Angular 中重新分配事件数组?
感谢@ADyson
我安装了 @fullcalendar/interaction
,因为它没有在 article 中安装,但包含在导入中,不确定是否重要。
我创建了另一个简单的项目,下面的代码有效,
if(this.timeline_val == ‘STTR’){
this.calendarOptions = {
initialView: ‘dayGridMonth’,
events: this.calendarEvents1
};
下面还加了,
deepChangeDetection="true"
我猜我的原始代码中有什么东西阻止了事件的更新。
我在Angular8中使用完整的日历,我给它分配了事件数组,它显示了一个用户的所有事件,
calendarOptions: CalendarOptions = {
initialView: ‘dayGridMonth’,
showNonCurrentDates: false,
fixedWeekCount: false,
events: this.calendarEvents
};
现在我有一个下拉列表,用户可以在其中 select 一个类别,具体取决于我需要分配特定事件数组的用户 select 的值, 我在下面的 if 条件下尝试,
if(this.timeline_val == ‘STTR’){
this.calendarOptions = {
initialView: ‘dayGridMonth’,
showNonCurrentDates: false,
fixedWeekCount: false,
events: this.calendarEvents1
};
但它不会被 events1 值覆盖。添加的新事件列表未反映在日历中。
我什至尝试在 if 条件下将新数组列表重新分配给先前的数组,但它不起作用。
if(this.timeline_val == 'ABC'){
this.calendarEvents = this.calendarEvents2; }
你能帮忙吗?如何在 Angular 中重新分配事件数组?
感谢@ADyson
我安装了 @fullcalendar/interaction
,因为它没有在 article 中安装,但包含在导入中,不确定是否重要。
我创建了另一个简单的项目,下面的代码有效,
if(this.timeline_val == ‘STTR’){
this.calendarOptions = {
initialView: ‘dayGridMonth’,
events: this.calendarEvents1
};
下面还加了,
deepChangeDetection="true"
我猜我的原始代码中有什么东西阻止了事件的更新。