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