Skip to content

Build fails when used in Angular Universal applications #470

@thilak-rao

Description

@thilak-rao

registerAccountCallback: window.location.href,

Reference to the window object makes it impossible to use angular-token on Angular Universal applications.

Would you accept the pull request, if I inject PLATFORM_ID to conditionally mock the reference to window.location while rendering on the server side?

Something like this:

constructor(
    @Inject(PLATFORM_ID) private platformId: Object
) {
    this.isServerSideRendering = isPlatformServer(platformId);

    if (this.isServerSideRendering) {
        // mock window.location
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions