How can a lazy loaded module inherit App Modules Declarations?

Viewed 2266

I have a lazy loaded module that needs to use a component. I have added it to app modules declarations and expect that this should make the declared component app wide.

Although Angular can't recognize the component in the lazy loaded module. I tried adding it to both module declarations then and got a warning asking to add the declaration in a higher module above the app.module and lazyLoaded.module.

e.g. (nameOfModule/Component)

Error: Type (DeclareMeComponent) is part of the declarations of 2 modules: (AppModule) and (LazyLoadedModule)! Please consider moving (DeclareMeComponent) to a higher module that imports AppModule and (LazyLoadedModule). You can also create a new NgModule that exports and includes (DeclareMeComponent) then import that NgModule in (AppModule) and (DeclareMeComponent).

What is higher than app.module? and how can I get the lazy loaded module to inherit/use the declared component along with app module?

1 Answers
Related