我正在尝试在 Angular 项目中生成新模块
ng g module core/employee-applicant --routing=true
并且生成的新模块引发异常
对装饰器的实验性支持是一项可能在未来版本中更改的功能。在“tsconfig”或“jsconfig”中设置“experimentalDecorators”选项以删除此警告。
并且在其他模块中它不会生成该错误。
有错误的新模块
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { EmployeeApplicantRoutingModule } from './employee-applicant-routing.module';
@NgModule({
declarations: [],
imports: [
CommonModule,
EmployeeApplicantRoutingModule
]
})
export class --> EmployeeApplicantModule (the error on visual studio code red under line){ }
不会弹出该错误的旧模块
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AuthRoutingModule } from './auth-routing.module';
import { LoginComponent } from './login/login.component';
import { MaterialModule } from 'src/app/shared/modules/material.module';
import { PipesModule } from 'src/app/pipes-module';
@NgModule({
declarations: [
LoginComponent
],
imports: [
CommonModule,
AuthRoutingModule,
FormsModule,
ReactiveFormsModule,
MaterialModule,
PipesModule,
]
})
export class AuthModule { }
与使用该新模块生成的路由模块相同。
因为experimentalDecorators
我在我项目的每个 tsconfig 文件中都添加了它
tsconfig.app.json
tsconfig.spec.json
tsconfig.json
tsconfig.base.json
如果有人能告诉我这些文件有什么区别
还有一件事,当我尝试将它导入到app.module时,它并没有显示出来,我认为这是因为那个错误