Angular 角度9-不是已知元素

Angular 角度9-不是已知元素,angular,angular8,angular-routing,angular9,Angular,Angular8,Angular Routing,Angular9,它一直工作到angular 7,现在更新后会抛出未知元素的错误。共享模块也是如此 可复制代码:- 所以我有一个父组件“parent”, “父级”-“子级”路由器内部使用的子组件 要在父级和子级内部使用的共享组件-“共享” 所以我在父模块和子模块中都导入了。(就像使用惰性模块一样),它在父级中工作,但在子级中不工作 import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; im

它一直工作到angular 7,现在更新后会抛出未知元素的错误。共享模块也是如此

可复制代码:-

所以我有一个父组件“parent”, “父级”-“子级”路由器内部使用的子组件 要在父级和子级内部使用的共享组件-“共享”

所以我在父模块和子模块中都导入了。(就像使用惰性模块一样),它在父级中工作,但在子级中不工作

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TestChildRoutingModule} from './test-child.routing.module';
import { SharedModule } from '../shared/shared.module';

@NgModule({
    declarations: [
    ],
    imports: [
        CommonModule,
        SharedModule,
        TestChildRoutingModule
    ],
    exports: [
    ]
})
export class TestChildModule { }


TestChildModule中缺少TestChildComponent的声明

@NgModule({
    declarations: [
      TestChildComponent
    ],
    imports: [
        CommonModule,
        SharedModule,
        TestChildRoutingModule
    ],
    exports: [
      TestChildComponent
    ]
})
export class TestChildModule { }

这是我将要发布的固定消息:)+1这是一个非常愚蠢的错误。谢谢Sajeetran和@pradeep