24 lines
609 B
TypeScript
24 lines
609 B
TypeScript
|
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||
|
import { _MODULE_CONFIG } from './types/token';
|
||
|
|
||
|
import { CommonApiService } from './services/common-api.service';
|
||
|
import { ModuleConfig } from './types/module-config';
|
||
|
|
||
|
const SERVICES = [CommonApiService];
|
||
|
|
||
|
@NgModule({
|
||
|
declarations: [],
|
||
|
imports: [],
|
||
|
exports: []
|
||
|
})
|
||
|
export class UCapCommonApiModule {
|
||
|
public static forRoot(
|
||
|
config: ModuleConfig
|
||
|
): ModuleWithProviders<UCapCommonApiModule> {
|
||
|
return {
|
||
|
ngModule: UCapCommonApiModule,
|
||
|
providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES]
|
||
|
};
|
||
|
}
|
||
|
}
|