【问题标题】:Uncaught ReferenceError: Cannot access 'NgxMatCalendar' before initialization?未捕获的 ReferenceError:在初始化之前无法访问“NgxMatCalendar”?
【发布时间】:2020-12-12 22:52:18
【问题描述】:

为什么我会收到Uncaught ReferenceError: Cannot access 'NgxMatCalendar' before initialization

我使用shared.module.ts,在其中使用与我的组件相关的导入和导出,并且我有我的app.module.ts,我在其中导入SharedModule。但是,我已经导入了接下来的两件事

import { NgxMatDatetimePickerModule, NgxMatTimepickerModule } from 'ngx-mat-datetime-picker';

在我的 NgModule 导入中:

NgxMatDatetimePickerModule,
NgxMatTimepickerModule,

但可能出了点问题,我不知道为什么。

错误说:

checkout-overview.component.ts:13 中的代码行是:

@Input() cartId: string;

edit-event-dialog.component.ts:24 中的代码行在其构造函数参数中:

@Inject(MAT_DIALOG_DATA) public data: any,

我不知道为什么会出错。谁能帮我解决这个问题?

【问题讨论】:

    标签: angular typescript angular-ui-router ngx-bootstrap uncaught-reference-error


    【解决方案1】:

    通过在 npm 上查找包,我发现它已被弃用,它们意味着切换到 @angular-material/...

    也许你可以先试试?

    编辑:

    作者消息:不再支持包。请改用@angular-material-components/datetime-picker,见link

    【讨论】:

    • 请将您的评论移至答案正文,因为它提供了更直接的解决方案。
    • @Ondie 谢谢!我是 Angular 和前端的新手,所以我什至不知道如何查找这个哈哈。谢谢!它奏效了。
    • @SzymonSeliga Done :) 我是新手,感谢您的建议
    猜你喜欢
    • 2020-05-06
    • 2021-03-10
    • 2020-06-02
    • 2020-06-02
    • 2022-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-29
    相关资源
    最近更新 更多