0

错误信息:

错误:src/app/pages/calander/calander.component.html:1:16 - 错误 NG8002:无法绑定到“选项”,因为它不是“完整日历”的已知属性。

  1. 如果'full-calendar'是一个Angular组件并且它有'options'输入,那么验证它是这个模块的一部分。
  2. 如果“full-calendar”是一个 Web 组件,则将“CUSTOM_ELEMENTS_SCHEMA”添加到该组件的“@NgModule.schemas”以禁止显示此消息。
  3. 要允许任何属性,请将“NO_ERRORS_SCHEMA”添加到此组件的“@NgModule.schemas”。

<full-calendar [options]="calendarOptions"> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/app/pages/calander/calander.component.ts:5:18 5 templateUrl: './calander.component.html', ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ 组件 CalanderComponent 的模板出错。

我完全按照这里的角度文档:https ://fullcalendar.io/docs/angular

导入 app.module.ts 中的所有内容

import { FullCalendarModule } from '@fullcalendar/angular'; // must go before plugins
import dayGridPlugin from '@fullcalendar/daygrid'; // a plugin!
import interactionPlugin from '@fullcalendar/interaction'; // a plugin!
@NgModule({
    declarations: [
        AppComponent,
        MainComponent,
        LoginComponent,
        HeaderComponent,
        FooterComponent,
        MenuSidebarComponent,
        BlankComponent,
        ProfileComponent,
        RegisterComponent,
        DashboardComponent,
        MessagesDropdownMenuComponent,
        NotificationsDropdownMenuComponent,
        AppButtonComponent,
        UserDropdownMenuComponent,
        ForgotPasswordComponent,
        RecoverPasswordComponent,
        LanguageDropdownComponent,
        PrivacyPolicyComponent,
        HomeComponent,
        ProjectComponent,
        PlanetComponent,
        // FullCalendarModule
    
    ],
    imports: [
        BrowserModule,
        HttpClientModule,
        AppRoutingModule,
        ReactiveFormsModule,
        BrowserAnimationsModule,
        FullCalendarModule,
        ToastrModule.forRoot({
            timeOut: 3000,
            positionClass: 'toast-bottom-right',
            preventDuplicates: true
        }),
        NgbModule
    ],
    providers: [],
    bootstrap: [AppComponent]
})
export class AppModule {}

在我的组件文件中使用它

import {Component} from '@angular/core';
import { CalendarOptions } from '@fullcalendar/angular'
@Component({
    selector: 'app-calander',
    templateUrl: './calander.component.html',
    styleUrls: ['./calander.component.scss']
})
export class CalanderComponent {
    calendarOptions: CalendarOptions = {
        initialView: 'dayGridMonth'
    };    
}

然后在我的 HTML 文件中传递这段代码,我得到了上述错误。

<full-calendar [options]="calendarOptions"></full-calendar>
4

0 回答 0