Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

localStorage is not defined (when using SSR) #73

Open
dssantana opened this issue Feb 19, 2021 · 5 comments
Open

localStorage is not defined (when using SSR) #73

dssantana opened this issue Feb 19, 2021 · 5 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@dssantana
Copy link

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

Thanks!

Diego

@SDohle
Copy link
Member

SDohle commented Feb 20, 2021

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

@dssantana
Copy link
Author

It's giving the exception:

image

@dssantana
Copy link
Author

Thanks!

@SDohle SDohle added bug Something isn't working enhancement New feature or request labels Feb 23, 2021
@miller45
Copy link
Contributor

@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
Copy link
Member

SDohle commented Feb 24, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Development

No branches or pull requests

3 participants