4.0.0 received no aot compilation error on { provide: 'windowObject', useValue: window }, #15495
Labels
area: compiler
Issues related to `ngc`, Angular's template compiler
area: core
Issues related to the framework runtime
area: server
Issues related to server-side rendering
core: di
freq2: medium
type: bug/fix
Milestone
When I was using 2.4.9 and tried to build aot, there was a compilation error regarding this:
I upgraded to 4.0.0, and didn't see the error. I thought Angular 4 is capable of understanding this usage now. I was wrong. In production at runtime, the window object is undefined.
In the end, I used the approach described here: https://juristr.com/blog/2016/09/ng2-get-window-ref/ and it works in 4.0.0
But if Angular 4 can't inject the window object with { provide: 'windowObject', useValue: window }, it should give an error during compilation like it did in 2.4.9.
The text was updated successfully, but these errors were encountered: