maciejtreder / ng-toolkit

:star: Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
https://www.angular-universal-pwa.maciejtreder.com
MIT License
1.12k stars 156 forks source link

this.window.addEventListener is not a function #622

Open pl4yradam opened 5 years ago

pl4yradam commented 5 years ago

I'm submitting a...


[ x ] Bug report  

In package


[ x ] @ng-toolkit/universal

Current behavior

Following the npm page, injecting the window into the constructor.

Expected behavior

Expecting it to use the window function

Minimal reproduction of the problem with instructions

 constructor(
        @Inject(WINDOW) private window: Window,
        private swUpdate: SwUpdate,
    ) {

        console.log(this.window);

        this.window.addEventListener('beforeinstallprompt', (event) => {
            this.promptEvent = event;
        });
    }

What is the motivation / use case for changing the behavior?

It doesn't work.

Environment


Angular version: Latest 7

- Node version: Latest
- Platform:  Windows

Others:

0xstupig commented 4 years ago

Same issue. Any possible solution?

KingDarBoja commented 4 years ago

@smapig Can you share your package.json file to checkout the version of ng-toolkit/universal being used?