Angular应用程序因JitCompiler错误而崩溃

时间:2019-08-25 12:15:29

标签: angular angular8

我已经接管了一个项目,并负责添加更多功能。因此,我添加了一些模块和组件,并且在应用程序启动并运行时崩溃。

Uncaught Error: Component EnquiryComponent is not part of any NgModule or the module has not been imported into your module.
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._createCompiledHostTemplate (compiler.js:27198)
    at compiler.js:27174
    at Array.forEach (<anonymous>)
    at compiler.js:27171
    at Array.forEach (<anonymous>)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (compiler.js:27160)
    at compiler.js:27088
    at Object.then (compiler.js:2400)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:27087)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler.compileModuleAsync (compiler.js:27047)

EnquiryComponent导入到app-module.ts

import { EnquiryComponent as CustomerEnquiryComponent } from './customer/enquiry/enquiry.component';

CustomerEnquiryComponent与其他几个组件一起导入。我可以正常运行ng compile,它会在20秒内完成。

1 个答案:

答案 0 :(得分:0)

您需要将其添加到模块的声明部分:

@NgModule({
declarations:[CustomerEnquiryComponent] 
})
相关问题