【发布时间】:2020-02-04 09:22:15
【问题描述】:
这个problem也出现在角度universal中:
我尝试install node-fetch-polyfill 并导入它。
//npm install node-fetch-polyfill
import * as fetch from "node-fetch-polyfill";
ngOnInit() {
if (typeof fetch !== 'function') {
(global as any).fetch = fetch;
}
}
但是还是不行,我的代码中没有直接使用fetch。
【问题讨论】:
-
文档似乎表明这是与 node.js 一起使用的。你确定它支持 Angular 吗?
-
@DelwynPinto 我不确定,但这是我目前能找到的解决方案。