8000 angular 4 server side prerending in CustomErrorHandler · Issue #85 · akserg/ng2-toasty · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
angular 4 server side prerending in CustomErrorHandler #85
Open
@trackx2k17

Description

@trackx2k17

Hi,

I got an error during server side prerending

Exception: Call to Node module failed with error: ReferenceError: window is not defined at ToastyComponent._setTimeout

`import {ErrorHandler, Inject, NgZone} from "@angular/core";
import {ToastyService} from "ng2-toasty";

export class AppErrorHandler implements ErrorHandler {

constructor(
    private ngZone: NgZone,
    @Inject(ToastyService) private toastyService: ToastyService){}

handleError(error: any): void {

    this.ngZone.run( () => {
        console.log(error);
        this.toastyService.error({
            title: 'Error',
            msg: 'An unexpected error happened.',
            theme: 'bootstrap',
            showClose: true,
            timeout: 5000
        });
    });
}

}`

if i use direcly toasty inside a compononent without the error handler class.... the prereding works well i can refresh the page without any problem.... only during the prerending using the error handler class

Any idea how to fix that

Thanks in advance

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

      0