Asp.net

ASP.NET CORE 2 + ANGULAR 4:NodeInvocationException:預渲染因錯誤而失敗:ReferenceError:未定義視窗

  • April 30, 2018

我正在嘗試使用 ngx-chips 進行標籤輸入,但是在導入 BrowserAnimationsModule 時遇到了這個問題。

在導入 BrowserAnimationsModule 時,我收到以下錯誤:

An unhandled exception occurred while processing the request.

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

一旦我在 app.module.shared.ts 下的 import 中評論 BrowserAnimationsModule,我的應用程序就可以正常工作,但是一旦我取消註釋它,我就會遇到同樣的錯誤。

請問我怎麼能把這個扔掉,我已經為此工作了4天多了。或者建議我使用 ASP.NET Core 2 SPA 模板的任何其他 angular 4 標記輸入庫。

謝謝…

在您視圖的 (Index.cshtml) 應用標記中,將 替換asp-prerender-moduleasp-ng2-prerender-module.

引用自:https://stackoverflow.com/questions/46695079