Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET CORE 2 + ANGULAR 4: NodeInvocationException: Prerendering failed because of error: ReferenceError: window is not defined

I am trying to use ngx-chips for tag-input, but I am having this issue with importing BrowserAnimationsModule.

On importing BrowserAnimationsModule, I get the error below:

An unhandled exception occurred while processing the request.

NodeInvocationException: document is not defined
ReferenceError: document is not defined

Once I comment BrowserAnimationsModule in import under app.module.shared.ts, my app works normal but once I uncomment it, I come up with the same error.

Please how can I trash this, I have been working on this for more than 4days. Or suggest any other angular 4 tag-input library I am using ASP.NET Core 2 SPA Template.

Thanks...

like image 925
Gmatt Matthew Afolabi Avatar asked Oct 11 '17 18:10

Gmatt Matthew Afolabi


1 Answers

In your view's (Index.cshtml) app tag, replace the asp-prerender-module with asp-ng2-prerender-module.

like image 195
Will Avatar answered Nov 14 '22 20:11

Will