Skip to content

Commit

Permalink
fix(module): force init
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Balet committed Aug 1, 2024
1 parent 09ec817 commit 2aaa3ea
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions projects/ngx-back-button/src/lib/ngx-back-button.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ModuleWithProviders, NgModule } from '@angular/core'
import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core'
import { NgxBackButtonServiceProvider } from './ngx-back-button.const'
import { NgxBackButtonDirective } from './ngx-back-button.directive'
import { NgxBackButtonServiceConfig } from './ngx-back-button.interface'
Expand All @@ -13,11 +13,16 @@ export class NgxBackButtonModule {
return {
ngModule: NgxBackButtonModule,
providers: [
NgxBackButtonService,
{
provide: NgxBackButtonServiceProvider,
useValue: config,
},
{
provide: APP_INITIALIZER,
useFactory: (service: NgxBackButtonService) => () => service,
deps: [NgxBackButtonService],
multi: true,
},
],
}
}
Expand Down

0 comments on commit 2aaa3ea

Please sign in to comment.