无法读取未定义的属性'emit'在导航链接全日历角度



我正在将 fullcalendar.io 的完整日历集成到我的 Angular 项目中。我安装了所有必需的插件,例如dayGrid,timeGrid,交互。我在这里使用导航链接 -> https://fullcalendar.io/docs/navLinks
我也看到了相同的问题解决方案:https://stackblitz.com/edit/angular-7chhen?file=src%2Fapp%2Fapp.component.html,但这里的导航链接工作正常。


MyCode
Html code ->

<full-calendar
#calendar
...
[navLinks]="true"
(navLinkDayClick)="navLinkDayClick($event)"
(navLinkWeekClick)="navLinkDayClick($event)"
></full-calendar>

在组件类 -> 中

...
calendarPlugins = [dayGridPlugin, timeGrigPlugin, interactionPlugin, bootstrap];
...
navLinkDayClick(date){
console.log('day');
}
navLinkWeekClick(date){
console.log('week');
}

单击日期时这是错误 ->

ERROR TypeError: Cannot read property 'emit' of undefined
at options.<computed> (fullcalendar-angular.js:303)
at HTMLAnchorElement.<anonymous> (main.esm.js:6622)
at HTMLElement.realHandler (main.esm.js:379)
at ZoneDelegate.invokeTask (zone-evergreen.js:391)
at Object.onInvokeTask (core.js:32819)
at ZoneDelegate.invokeTask (zone-evergreen.js:390)
at Zone.runTask (zone-evergreen.js:168)
at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:465)
at invokeTask (zone-evergreen.js:1603)
at HTMLElement.globalZoneAwareCallback (zone-evergreen.js:1629) defaultErrorLogger @ core.js:4799 handleError @ core.js:4851 next @ core.js:33552 schedulerFn @ core.js:29522
__tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122
_next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:29484 (anonymous) @ core.js:32877 invoke @ zone-evergreen.js:359 run @ zone-evergreen.js:124 runOutsideAngular @ core.js:32764 onHandleError @ core.js:32874 handleError @ zone-evergreen.js:363 runTask @ zone-evergreen.js:171 invokeTask @ zone-evergreen.js:465 invokeTask @ zone-evergreen.js:1603 globalZoneAwareCallback @ zone-evergreen.js:1629

还有 package.json -> 中的依赖项

"@fullcalendar/angular": "^4.3.1",
"@fullcalendar/bootstrap": "^4.3.0",
"@fullcalendar/core": "^4.3.1",
"@fullcalendar/daygrid": "^4.3.0",
"@fullcalendar/interaction": "^4.3.0",
"@fullcalendar/list": "^4.3.0",
"@fullcalendar/luxon": "^4.3.0",
"@fullcalendar/moment": "^4.3.0",
"@fullcalendar/moment-timezone": "^4.3.0",
"@fullcalendar/timegrid": "^4.3.0",

模块 ->

@NgModule({
imports: [
...
FullCalendarModule
],
declarations: [
...
UsersWorkCalendarComponent,
],
entryComponents: [
...
UsersWorkCalendarComponent,
]
})
export class DashboardModule { }

这是最新版本的错误 github 关闭问题,但在 4.3.1 中可重现

我的建议是降级到您在堆栈闪电战中使用的 2.4.1 版本,因为这是一个反复出现的错误(检查 github 问题和链接问题(。

最新更新