-
Notifications
You must be signed in to change notification settings - Fork 362
/
toastr.module.ts
36 lines (33 loc) 路 915 Bytes
/
toastr.module.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { ModuleWithProviders, NgModule } from '@angular/core';
import { Toast } from './toast.component';
import { DefaultNoComponentGlobalConfig, GlobalConfig, TOAST_CONFIG } from './toastr-config';
import { provideToastr } from './toast.provider';
@NgModule({
imports: [Toast],
exports: [Toast],
})
export class ToastrModule {
static forRoot(config: Partial<GlobalConfig> = {}): ModuleWithProviders<ToastrModule> {
return {
ngModule: ToastrModule,
providers: [provideToastr(config)],
};
}
}
@NgModule({})
export class ToastrComponentlessModule {
static forRoot(config: Partial<GlobalConfig> = {}): ModuleWithProviders<ToastrModule> {
return {
ngModule: ToastrModule,
providers: [
{
provide: TOAST_CONFIG,
useValue: {
default: DefaultNoComponentGlobalConfig,
config,
},
},
],
};
}
}