Import a component from a lazy loadable module to another lazy module

I followed the Tour-of-Hero tutorial on the official Angular2 page. But I took another step by adding lazy-loading modules.

I have the following function modules:

  • Module Dashboard

    • toolbar component
  • Module Hero

    • hero list component
    • hero component component
    • hero search component
    • hero search service
    • hero model

The hero-search component is a directive that should be used in the dashboard module.

However, according to this Angular2 architechture documentation, the Routed module should not be imported by others. So I do not have to import the Hero module into the Dashboard module. If I do, my routes no longer work.

, - -, Hero Module .

, Dashboard?

+4
2

, UtilityModule, HeroSearch, UtilityModule DashboardModule HeroModule. , HeroSearch .

@NgModule({
  imports: [ ... ],
  declarations: [ ... ],
  exports: [ HeroSearch ]
})

export class UtilityModule { }
+2

, . Lazy . . . , , Hero . , - , , , ?

, , , . , . .

0

Source: https://habr.com/ru/post/1655532/


All Articles