You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular15集成FullCalendar报错:registerPlugins不存在于FullCalendarModule

解决FullCalendar Angular 15中registerPlugins不存在的错误

错误原因

FullCalendar v6版本对Angular集成的API做了调整,FullCalendarModule不再提供registerPlugins静态方法,原有的插件注册方式已被废弃。

具体修复步骤

  1. 删除代码中这段无效的注册代码:
FullCalendarModule.registerPlugins([
  // register FullCalendar plugins
  dayGridPlugin,
  interactionPlugin,
]);
  1. 在模块的imports数组中,将FullCalendarModule替换为FullCalendarModule.forRoot()方法,并在配置参数中传入插件数组:

修改后的完整模块代码:

import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";

import { TakvimRoutingModule } from "./takvim-routing.module";
import { FormsModule } from "@angular/forms";
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
import { SweetAlert2Module } from "@sweetalert2/ngx-sweetalert2";
import { TableModule } from "primeng/table";
import { ButtonModule } from "primeng/button";
import { NgSelectModule } from "@ng-select/ng-select";
import { TakvimComponent } from "./takvim.component";
import { FullCalendarModule } from "@fullcalendar/angular";
import dayGridPlugin from "@fullcalendar/daygrid";
import interactionPlugin from "@fullcalendar/interaction";
import { PerfectScrollbarModule } from "ngx-perfect-scrollbar";
import { CalendarModule } from "primeng/calendar";

@NgModule({
  declarations: [TakvimComponent],
  imports: [
    CommonModule,
    TakvimRoutingModule,
    FormsModule,
    NgbModule,
    PerfectScrollbarModule,
    FeahterIconModule,
    CalendarModule,
    SweetAlert2Module.forChild(),
    TableModule,
    ButtonModule,
    NgSelectModule,
    // 改用forRoot方法注册插件
    FullCalendarModule.forRoot({
      plugins: [dayGridPlugin, interactionPlugin]
    })
  ],
})
export class TakvimModule {}

补充说明

这种方式是FullCalendar v6官方推荐的Angular插件注册方案,通过forRoot()方法一次性完成模块导入和插件配置,同时也符合Angular的模块初始化规范。

内容的提问来源于stack exchange,提问作者hasancali

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 14:47:11