I have created an Angular Library. In my Library I would it like it to be clean by having feature modules inside them:
Example:
Library
NavigationModule
NavigationSideBarComponent
NavigationTopComponent
Navigation Service
etc
GraphModule
BarGraphComponent
PieGraphComponent
My Navigation Module currently looks like this:
@NgModule({
declarations: [
NavigationSidebarComponent
],
imports: [
CommonModule,
MatSidenavModule
],
exports: [
NavigationSidebarComponent
]
})
export class NavigationModule { }
My Library Module currently looks like this:
@NgModule({
declarations: [LibraryComponent],
imports: [
NavigationModule
],
exports: [
LibraryComponent
//NavigationSidebarComponent <-- Did not work
]
})
export class LibraryModule { }
Most tutorials I am finding is using a library with only components in them and nothing else such as modules. The tutorials I do find using modules in a library do not show how to export pieces.
Essentially I want to import this Library into any application and be able to call NavigationSidebarComponent
or any other component from a module in the library or service.
I will keep looking into this on my end.
You have to export NavigationModule
in the LibraryModule
, not NavigationSidebarComponent
来源:https://stackoverflow.com/questions/54012806/angular-library-modules-export-components-services-and-others-from-module