从 utils.js 收到消息“NotYetImplemented”的错误。
我在使用nodejs服务器时收到错误,这个错误到底意味着什么?
当我使用“ngserve”时,没有这样的错误。
我正在使用 ng2-charts 模块中的折线图。
完整的堆栈跟踪:
ERROR Error: NotYetImplemented
at HTMLCanvasElement.exports.nyi (/home/project15/web/node_modules/domino/lib/utils.js:41:9)
at BaseChartDirective.ngOnInit (/home/project15/web/node_modules/ng2-charts/charts/charts.js:24:47)
at checkAndUpdateDirectiveInline (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:12439:19)
at checkAndUpdateNodeInline (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13966:20)
at checkAndUpdateNode (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13909:16)
at prodCheckAndUpdateNode (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14633:5)
at Object.updateDirectives (/home/project15/web/dist-server/main.bundle.js:1:51133)
at Object.updateDirectives (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14355:29)
at checkAndUpdateView (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:13875:14)
at callViewAction (/home/project15/web/node_modules/@angular/core/bundles/core.umd.js:14226:21)
使用以下内容:
NodeJS:9.3.0
角度:5.1.2
操作系统:Linux x64
“chart.js”:“^2.7.1”
“ng2-charts”:“^1.6.0”
EDIT :
节点服务器设置:
https://medium.com/@cyrilletuzi/angular-server-side-rendering-in-node-with-express-universal-engine-dce21933ddce https://medium.com/@cyrilletuzi/angular-server-side-rendering-in-node-with-express-universal-engine-dce21933ddce
运行命令时访问 Web url 后,终端中会出现错误
node server.js
我遇到了同样的问题并解决如下:
1-在组件中创建一个布尔值.ts文件并像这样设置它的值
import { Inject, PLATFORM_ID } from "@angular/core";
import { isPlatformBrowser } from "@angular/common";
isBrowser: boolean;
constructor(@Inject(PLATFORM_ID) private platformId: unknown) {}
ngOnInit(): void {
this.isBrowser = isPlatformBrowser(this.platformId);
}
2-然后在你的HTML文件使用 ng2-charts HTML 标签,如下所示
<canvas *ngIf="isBrowser"
baseChart
...
...
... >
</canvas>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)