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