dependencies dependencies cluster_NotificationModule cluster_NotificationModule_imports cluster_NotificationModule_providers TranslationsModule TranslationsModule NotificationModule NotificationModule TranslationsModule->NotificationModule NotificationService NotificationService NotificationService->NotificationModule

File

lib/common/src/notifications/notification.module.ts

Methods

Static forChild
forChild(notificationConfigs: NotificationConfig[])
Parameters :
Name Type Optional Default value
notificationConfigs NotificationConfig[] No []
Returns : ModuleWithProviders<NotificationModule>
import	{	
			NgModule,
			ModuleWithProviders,

			Optional,
			SkipSelf
		}								from '@angular/core'

import	{	
			NOTIFICATION_COUNTERS,
			NotificationConfig,
			NotificationService
		}								from './notification.service'

import	{
			TranslationsModule
		}								from '../translations'

import en from './i18n/en.json'
import de from './i18n/de.json'




@NgModule({
	imports:[
		TranslationsModule.forChild("NOTIFICATIONS", {en, de}),
	],
	providers: [
		NotificationService,
	]
})
export class NotificationModule { 

	static forChild(notificationConfigs: NotificationConfig[] = []): ModuleWithProviders<NotificationModule> {

		return 	{
					ngModule:	NotificationModule,
					providers:	[
									...notificationConfigs.map( notificationConfig => ({
										provide: 	NOTIFICATION_COUNTERS,
										multi:		true,
										deps:		notificationConfig.deps,
										useFactory:	notificationConfig.factory
									}))
								]
				}
	}
}

results matching ""

    No results matching ""