fix: forRoot method working

This commit is contained in:
Aleksandr Bukhalo 2020-03-19 19:23:51 +03:00
parent 25710b7908
commit ee0ad03af8

View File

@ -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],
};
}