rosen-group / ngx-onboarding

Onboarding module for Angular applications
Other
51 stars 13 forks source link

localStorage is not defined (when using SSR) #73

Open dssantana opened 3 years ago

dssantana commented 3 years ago

The exception is raised when using SSR. is it possible to add the condition of if (isPlatformBrowser(this.platformId)) { //use localStorage }

Thanks!

Diego

SDohle commented 3 years ago

Thanks for your feedback. We don't have a project using onboarding and SSR. Can you provide the exact error please?

dssantana commented 3 years ago

It's giving the exception:

image

dssantana commented 3 years ago

Thanks!

miller45 commented 3 years ago

@SDohle Actually we do the following in our module file: ` providers: [ BrowserDOMSelectorService, WindowRef, { provide: SeenSelectorsBaseService, useClass: LocalStorageSeenSelectorsService }, { provide: EnabledStatusBaseService, useClass: LocalStorageEnabledStatusService }, { provide: TranslatorBaseService, useClass: BuildInTranslatorService }

]`

Is there a way to allow users to override this configuration? because I had a pluggable storageprovider planned. as you can see

SDohle commented 3 years ago

Because of the DI hirachy it should be possible to just provide another implementation at application level (in app.module.ts) to override the inject inside the module? @miller45