You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.0 KiB
38 lines
1.0 KiB
import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
|
|
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
import { TreoMockApiInterceptor } from '@treo/lib/mock-api/mock-api.interceptor';
|
|
import { TreoMockApiService } from '@treo/lib/mock-api/mock-api.service';
|
|
|
|
@NgModule({
|
|
providers: [
|
|
TreoMockApiService,
|
|
{
|
|
provide : HTTP_INTERCEPTORS,
|
|
useClass: TreoMockApiInterceptor,
|
|
multi : true
|
|
}
|
|
]
|
|
})
|
|
export class TreoMockApiModule
|
|
{
|
|
/**
|
|
* forRoot method for setting user configuration
|
|
*
|
|
* @param mockDataServices
|
|
*/
|
|
static forRoot(mockDataServices: any[]): ModuleWithProviders<TreoMockApiModule>
|
|
{
|
|
return {
|
|
ngModule : TreoMockApiModule,
|
|
providers: [
|
|
{
|
|
provide : APP_INITIALIZER,
|
|
deps : mockDataServices,
|
|
useFactory: () => () => null,
|
|
multi : true
|
|
},
|
|
]
|
|
};
|
|
}
|
|
}
|