If in my Index.cshtml this line of code is present:
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
I get an error:
_NodeInvocationException: window is not defined
ReferenceError: window is not defined
at Adal5Service.init (_
If I move Adal5Service declaration from app.module.server to app.module.browser the error changes to:
_NodeInvocationException: StaticInjectorError(AppModule)[AppComponent -> Adal5Service]:
StaticInjectorError(Platform: core)[AppComponent -> Adal5Service]:
NullInjectorError: No provider for Adal5Service!
Error: StaticInjectorError(AppModule)[AppComponent -> Adal5Service]:
StaticInjectorError(Platform: core)[AppComponent -> Adal5Service]:
NullInjectorError: No provider for Adal5Service!_
But if I replace line
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
with line
<app asp-ng2-prerender-module="ClientApp/dist/main-server">Loading...</app>
in file Index.cshtml - Everything works fine.
Is this an expected behavior or is this an error?
Thank you.
If You using asp-prerender-module, probably any angular library which is using window object will throw exception
Please read this issue it may be helpfull.
If in my Index.cshtml this line of code is present:
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
I get an error:If I move Adal5Service declaration from app.module.server to app.module.browser the error changes to:
But if I replace line
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
with line<app asp-ng2-prerender-module="ClientApp/dist/main-server">Loading...</app>
in file Index.cshtml - Everything works fine.Is this an expected behavior or is this an error? Thank you.