Node.js 版本8.2.14中的角材料问题

Node.js 版本8.2.14中的角材料问题,node.js,angular,typescript,Node.js,Angular,Typescript,编辑(08/20/2020 14:12h): 由于HTML解析,我获得了更多详细信息: Uncaught Error: Template parse errors: 'mat-card-title' is not a known element: 1. If 'mat-card-title' is an Angular component, then verify that it is part of this module. 2. If 'mat-card-title' is a Web Co

编辑(08/20/2020 14:12h)

由于HTML解析,我获得了更多详细信息:

Uncaught Error: Template parse errors:
'mat-card-title' is not a known element:
1. If 'mat-card-title' is an Angular component, then verify that it is part of this module.
2. If 'mat-card-title' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
<mat-card>
  <mat-card-header>
    [ERROR ->]<mat-card-title>Login</mat-card-title>
  </mat-card-header>
  <mat-card-content>
"): ng:///AppModule/LoginComponent.html@11:4
'mat-card-header' is not a known element:
1. If 'mat-card-header' is an Angular component, then verify that it is part of this module.
2. If 'mat-card-header' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
有什么解决办法吗?谢谢!:)


看到关于这个主题的这些问题:,并按如下方式实现模块,编译器给了我一个错误

角材料.模块.ts

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

import {
  MatCardModule,
  MatDialogModule,
  MatMenuModule,
   MatButtonModule,
   MatToolbarModule,
   MatIconModule,
   MatBadgeModule,
   MatSidenavModule,
   MatListModule,
   MatGridListModule,
   MatFormFieldModule,
   MatInputModule,
   MatSelectModule,
   MatRadioModule,
   MatDatepickerModule,
   MatNativeDateModule,
   MatChipsModule,
   MatTooltipModule,
   MatTableModule,
   MatPaginatorModule,
   MatProgressSpinnerModule
} from '@angular/material';

@NgModule({
   imports: [
    MatCardModule, 
    MatDialogModule, 
    MatMenuModule,
    MatProgressSpinnerModule,
      CommonModule,
      MatButtonModule,
      MatToolbarModule,
      MatIconModule,
      MatSidenavModule,
      MatBadgeModule,
      MatListModule,
      MatGridListModule,
      MatFormFieldModule,
      MatInputModule,
      MatSelectModule,
      MatRadioModule,
      MatDatepickerModule,
      MatNativeDateModule,
      MatChipsModule,
      MatTooltipModule,
      MatTableModule,
      MatPaginatorModule
   ],
   exports: [
    MatCardModule, 
    MatDialogModule, 
    MatMenuModule,
    MatProgressSpinnerModule,
      MatButtonModule,
      MatToolbarModule,
      MatIconModule,
      MatSidenavModule,
      MatBadgeModule,
      MatListModule,
      MatGridListModule,
      MatInputModule,
      MatFormFieldModule,
      MatSelectModule,
      MatRadioModule,
      MatDatepickerModule,
      MatChipsModule,
      MatTooltipModule,
      MatTableModule,
      MatPaginatorModule
   ],
   providers: [
      MatDatepickerModule,
   ]
})

export class AngularMaterialModule { }
最近,在package.json中,我添加了这样的内容,以放置一个与node_modules/@angular/material/index.d.ts兼容的旧版本:

"dependencies": {
    "@angular/animations": "~8.2.14",
    "@angular/common": "~8.2.14",
    "@angular/compiler": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/forms": "~8.2.14",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "chokidar": "^3.4.2",
    "core-js": "^3.6.5",
    "rxjs": "~6.4.0",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },
最后,在app.module.ts中,我添加了依赖项文件:

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { LoginComponent } from './login/login.component';
import { LogoutComponent } from './logout/logout.component';
import { AngularMaterialModule } from './angular-material.module';
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
import { HeaderComponent } from './header/header.component';
import { UserComponent } from './user/user.component';
import { FooterComponent } from './footer/footer.component';
import {BasicAuthHtppInterceptorService} from './service/basic-auth-interceptor.service';
我的应用程序结构与此类似:


为了在这个版本上显示HTML标签,我应该怎么做?提前感谢:)

根据您的package.json,您使用的是Angular 8.3,您有@Angular/cdk@10.1.3. 您可以通过使用来降级angular/cdk版本

npm i @angular/cdk@8.2.1 
或者,您可以通过运行以下命令将Angular版本升级到v9:

ng update @angular/core @angular/cli

这会将您的本地角度版本更新为9。然后,为了同步材质,运行:
ng update@angular/material

根据您的包。json,您使用的是angular 8.3,您有@angular/cdk@10.1.3. 您可以通过使用来降级angular/cdk版本

npm i @angular/cdk@8.2.1 
或者,您可以通过运行以下命令将Angular版本升级到v9:

ng update @angular/core @angular/cli

这会将您的本地角度版本更新为9。然后,只是为了同步材料,运行:
ng update@angular/material

我明白了,谢谢你的好奇,但我仍然需要在版本8.2.14中,所有材料都通过HTML运行。例如,如果是,请将所有版本保持在8.2或更低版本。我明白了,谢谢你的好奇,但我需要的是8.2.14版本,所有的资料都是通过HTML运行的。例如,如果是,请将所有版本保持在8.2或更低版本。它会起作用的。