Can't bind to 'x' since it isn't a known property of 'y'

后端 未结 5 1482
谎友^
谎友^ 2020-12-16 08:56

I have an angular site that contains a component inside another component. I\'m using routing and lazy loading the outer component (ComponentA). The inner component (Compone

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 09:50

    I went back to the start and realised what I missed:

    In feature-b.module.ts I should have exported the component:

    exports: [
        FeatureBComponent
    ]
    

    It was also necessary for me to import FeatureBModule rather than FeatureBComponent.

    import { FeatureBComponent } from '../feature-b/feature-b.component';

    import { FeatureBModule } from '../feature-b/feature-b.module';
    

提交回复
热议问题