ngx-easy-d3
Version:
Build an Angular library compatible with AoT compilation and Tree shaking like an official package
47 lines (41 loc) • 1.3 kB
text/typescript
import { NgModule, ModuleWithProviders } from '@angular/core';
import { SumService } from '../services/sum.service';
import { SumComponent } from '../components/test/sum.component';
@NgModule({
declarations: [
// Pipes.
// Directives.
// Components.
SumComponent
],
exports: [
// Pipes.
// Directives.
// Components.
SumComponent
]
})
// Consider registering providers using a forRoot() method
// when the module exports components, directives or pipes that require sharing the same providers instances.
// Consider registering providers also using a forChild() method
// when they requires new providers instances or different providers in child modules.
export class ArithmeticModule {
/**
* Use in AppModule: new instance of SumService.
*/
public static forRoot(): ModuleWithProviders<ArithmeticModule> {
return {
ngModule: ArithmeticModule,
providers: [SumService]
};
}
/**
* Use in features modules with lazy loading: new instance of SumService.
*/
public static forChild(): ModuleWithProviders<ArithmeticModule> {
return {
ngModule: ArithmeticModule,
providers: [SumService]
};
}
}