Angular compiler报的一个错误消息:Component XX is not part of any NgModule

简介: Angular compiler报的一个错误消息:Component XX is not part of any NgModule

Error in /turbo_modules/@angular/compiler@9.1.12/bundles/compiler.umd.js (29363:23)

Component ProductListComponent is not part of any NgModule or the module has not been imported into your module.


image.png

错误分析

app.module.ts里,只import了ProductListComponent,但却未申明到declarations区域内:image.png

添加之后错误消失:

image.png

相关文章
|
4月前
Angular多个页面引入同一个组件报错The Component ‘MyComponentComponent‘ is declared by more than one NgModule怎么办?
Angular多个页面引入同一个组件报错The Component ‘MyComponentComponent‘ is declared by more than one NgModule怎么办?
Angular NgModule 中的 declarations 和 exports定义
我在app.component.ts的template文件里试图使用另一个Component时,遇到如下错误消息: app-parent-child is not a known element:
Angular NgModule 中的 declarations 和 exports定义
Angular NgModule里定义的注解和NgModuleRef$1运行时
Angular NgModule里定义的注解和NgModuleRef$1运行时
90 0
Angular NgModule里定义的注解和NgModuleRef$1运行时
Angular @NgModule providers里multi等于true在源代码里如何体现的
Angular @NgModule providers里multi等于true在源代码里如何体现的
91 0
Angular @NgModule providers里multi等于true在源代码里如何体现的
|
前端开发 JavaScript
angular基本知识学习笔记 - NgModule的基本概念
angular基本知识学习笔记 - NgModule的基本概念
100 0
angular基本知识学习笔记 - NgModule的基本概念
Angular NgModule providers字段维护了多个字段后的初始化实现
Angular NgModule providers字段维护了多个字段后的初始化实现
Angular NgModule providers字段维护了多个字段后的初始化实现
Angular NgModule里定义的注解和NgModuleRef$1运行时
Angular NgModule里定义的注解和NgModuleRef$1运行时
Angular NgModule里定义的注解和NgModuleRef$1运行时
Angular @NgModule providers里multi等于true在源代码里如何体现的
Angular @NgModule providers里multi等于true在源代码里如何体现的
Angular @NgModule providers里multi等于true在源代码里如何体现的
Angular2 小贴士 NgModule 模块
angular2 具有了模块的概念,响应了后台程序的号召,高内聚 低耦合。模块就是用来进行封装,进行高内聚  低耦合的功能。 其实各人认为ng2 的模块和.net的工程类似,如果要使用模块中定义的功能,第一步就是必须要引用它,ng2 中叫import 导入。
1108 0
|
2月前
|
设计模式 JavaScript 前端开发
什么是 Angular 应用里的 Custom provider
什么是 Angular 应用里的 Custom provider
30 2

热门文章

最新文章