gpt4 book ai didi

angular-material - MatCheckbox 没有被 ngcc 正确处理,或者与 Angular Ivy 不兼容

转载 作者:行者123 更新时间:2023-12-03 23:20:35 26 4
gpt4 key购买 nike

我正在尝试将最新的 Angular Material 与 Angular 9 一起使用,但我遇到了以下问题

这是我的 app.modul.ts

import { NgModule } from '@angular/core';
import { CommonModule, CurrencyPipe } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientJsonpModule } from '@angular/common/http';
import { HttpClientModule } from '@angular/common/http';
import { ModalModule } from 'ngx-bootstrap/modal';
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { CollapseModule } from 'ngx-bootstrap/collapse';
import { TabsModule } from 'ngx-bootstrap/tabs';
import { NgxPaginationModule } from 'ngx-pagination';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ServiceProxyModule } from '@shared/service-proxies/service-proxy.module';
import { SharedModule } from '@shared/shared.module';
import { HomeComponent } from '@app/home/home.component';
import { AboutComponent } from '@app/about/about.component';
// tenants
import { TenantsComponent } from '@app/tenants/tenants.component';
import { CreateTenantDialogComponent } from './tenants/create-tenant/create-tenant-dialog.component';
import { EditTenantDialogComponent } from './tenants/edit-tenant/edit-tenant-dialog.component';
// roles
import { RolesComponent } from '@app/roles/roles.component';
import { CreateRoleDialogComponent } from './roles/create-role/create-role-dialog.component';
import { EditRoleDialogComponent } from './roles/edit-role/edit-role-dialog.component';
// users
import { UsersComponent } from '@app/users/users.component';
import { CreateUserDialogComponent } from '@app/users/create-user/create-user-dialog.component';
import { EditUserDialogComponent } from '@app/users/edit-user/edit-user-dialog.component';
import { ChangePasswordComponent } from './users/change-password/change-password.component';
import { ResetPasswordDialogComponent } from './users/reset-password/reset-password.component';
// layout
import { HeaderComponent } from './layout/header.component';
import { HeaderLeftNavbarComponent } from './layout/header-left-navbar.component';
import { HeaderLanguageMenuComponent } from './layout/header-language-menu.component';
import { HeaderUserMenuComponent } from './layout/header-user-menu.component';
import { FooterComponent } from './layout/footer.component';
import { SidebarComponent } from './layout/sidebar.component';
import { SidebarLogoComponent } from './layout/sidebar-logo.component';
import { SidebarUserPanelComponent } from './layout/sidebar-user-panel.component';
import { SidebarMenuComponent } from './layout/sidebar-menu.component';
import { ChatComponent } from './chat/chat.component';
import { Chat2Component } from './chat2/chat2.component';
import { CitizenInterestsComponent } from './citizen-interests/citizen-interests.component';

import {MAT_CHECKBOX_CLICK_ACTION, MatCheckbox} from '@angular/material/checkbox';

@NgModule({
declarations: [
AppComponent,
HomeComponent,
AboutComponent,
// tenants
TenantsComponent,
CreateTenantDialogComponent,
EditTenantDialogComponent,
// roles
RolesComponent,
CreateRoleDialogComponent,
EditRoleDialogComponent,
// users
UsersComponent,
CreateUserDialogComponent,
EditUserDialogComponent,
ChangePasswordComponent,
ResetPasswordDialogComponent,
// layout
HeaderComponent,
HeaderLeftNavbarComponent,
HeaderLanguageMenuComponent,
HeaderUserMenuComponent,
FooterComponent,
SidebarComponent,
SidebarLogoComponent,
SidebarUserPanelComponent,
SidebarMenuComponent,
ChatComponent,
Chat2Component,
CitizenInterestsComponent
],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
HttpClientModule,
HttpClientJsonpModule,
ModalModule.forChild(),
BsDropdownModule,
CollapseModule,
TabsModule,
AppRoutingModule,
ServiceProxyModule,
SharedModule,
NgxPaginationModule,
MatCheckbox




],
providers: [],
entryComponents: [
// tenants
CreateTenantDialogComponent,
EditTenantDialogComponent,
// roles
CreateRoleDialogComponent,
EditRoleDialogComponent,
// users
CreateUserDialogComponent,
EditUserDialogComponent,
ResetPasswordDialogComponent
],
})
export class AppModule {}



node_modules/@angular/material/checkbox/checkbox.d.ts:56:22 中的 错误 - 错误 NG6002:出现在 AppModule 的 NgModule.imports 中,但无法解析为 NgModule 类。
这可能意味着声明 MatCheckbox 的库 (@angular/material/checkbox) 没有被 ngcc 正确处理,或者与 Angular Ivy 不兼容。检查是否有更新版本的库可用,如果有则更新。还可以考虑与库的作者核对以查看该库是否与 Ivy 兼容。

最佳答案

我找到了解决方案 here

我是导入 Matcheckbox 而不是 MatCheckboxModule

在此之前,我运行了这个命令 npm ci 我不知道这是否会影响但我所做的。

关于angular-material - MatCheckbox 没有被 ngcc 正确处理,或者与 Angular Ivy 不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62445723/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com