Skip to content

Commit 9feffdc

Browse files
authored
feat(driver): add in-memory module (#3177)
1 parent 91e28de commit 9feffdc

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

libs/driver/in-memory/src/module.ts

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import {
2+
NgModule,
3+
ModuleWithProviders,
4+
importProvidersFrom,
5+
} from '@angular/core';
6+
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';
7+
8+
import { DaffInMemoryRootBackend } from './backend/public_api';
9+
import {
10+
DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT,
11+
DaffInMemoryDriverConfig,
12+
provideDaffInMemoryDriverConfig,
13+
} from './config/public_api';
14+
15+
/**
16+
* Sets up the angular in memory web API with the {@link DaffInMemoryRootBackend}.
17+
*/
18+
@NgModule()
19+
export class DaffInMemoryDriverModule {
20+
static forRoot(config: DaffInMemoryDriverConfig = DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT): ModuleWithProviders<DaffInMemoryDriverModule> {
21+
return {
22+
ngModule: DaffInMemoryDriverModule,
23+
providers: [
24+
importProvidersFrom(HttpClientInMemoryWebApiModule.forRoot(DaffInMemoryRootBackend, config)),
25+
provideDaffInMemoryDriverConfig(config),
26+
],
27+
};
28+
}
29+
}
+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './backend/public_api';
22
export * from './driver/public_api';
33
export * from './config/public_api';
4+
export * from './module';

0 commit comments

Comments
 (0)