From ee0ad03af83e1e8aad9d5f2e75b124739a042efb Mon Sep 17 00:00:00 2001 From: Aleksandr Bukhalo Date: Thu, 19 Mar 2020 19:23:51 +0300 Subject: [PATCH] fix: forRoot method working --- lib/telegraf-core.module.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/telegraf-core.module.ts b/lib/telegraf-core.module.ts index 0e45913..49b2ee4 100644 --- a/lib/telegraf-core.module.ts +++ b/lib/telegraf-core.module.ts @@ -19,10 +19,18 @@ import { TelegrafProvider } from './telegraf.provider'; }) export class TelegrafCoreModule { public static forRoot(options: TelegrafModuleOptions): DynamicModule { + const telegrafProvider = { + provide: TELEGRAF_PROVIDER, + useClass: TelegrafProvider, + inject: [TELEGRAF_MODULE_OPTIONS], + }; return { module: TelegrafCoreModule, - providers: [], - exports: [], + providers: [ + { provide: TELEGRAF_MODULE_OPTIONS, useValue: options }, + telegrafProvider, + ], + exports: [telegrafProvider], }; }