错误:NotYetImplemented 在HTMLCanvasElement.exports.nyi(C:\ frontend_server_side_rendering \ NewUIUX2nd \ bbbcustomerui \ dist \ server.js:30071:9) 在C:\ frontend_server_side_rendering \ NewUIUX2nd \ bbbcustomerui \ dist \ server.js:391458:34898 在C:\ frontend_server_side_rendering \ NewUIUX2nd \ bbbcustomerui \ dist \ server.js:391458:35221 在C:\ frontend_server_side_rendering \ NewUIUX2nd \ bbbcustomerui \ dist \ server.js:391458:45461 在对象。 (C:\ frontend_server_side_rendering \ NewUIUX2nd \ bbbcustomerui \ dist \ server.js:391458:47139) 在 webpack_require 上(C:\ frontend_server_side_rendering \ NewUIUX2nd \ bbbcustomerui \ dist \ server.js:20:30) 在Object.web-animations-js(C:\ frontend_server_side_rendering \ NewUIUX2nd \ bbbcustomerui \ dist \ server.js:371112:18) 在 webpack_require 上(C:\ frontend_server_side_rendering \ NewUIUX2nd \ bbbcustomerui \ dist \ server.js:364897:30) 在Object ../ src / app / home / home.component.ts(C:\ frontend_server_side_rendering \ NewUIUX2nd \ bbbcustomerui \ dist \ server.js:366546:1) 在 webpack_require (C:\ frontend_server_side_rendering \ NewUIUX2nd \ bbbcustomerui \ dist \ server.js:364897:30)
我正在解决这个错误的角度5服务器端渲染
答案 0 :(得分:3)
这是因为SSR DOM实现尚不支持element 参见:angular/universal-starter#538 (comment)
如果要与Angular Universal一起使用,请添加到HTML:
<canvas *ngIf="isBrowser">
在组件中的 .ts 文件中,如下所示:
import { Inject, PLATFORM_ID } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
public isBrowser: boolean;
constructor(@Inject(PLATFORM_ID) platformId: Object, private renderer2: Renderer2) {
this.isBrowser = isPlatformBrowser(platformId);
}
上了解有关此内容的更多信息