Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/388.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Angular 2中加载自定义CDN_Javascript_Angular_Cdn - Fatal编程技术网

Javascript 在Angular 2中加载自定义CDN

Javascript 在Angular 2中加载自定义CDN,javascript,angular,cdn,Javascript,Angular,Cdn,我是Angular 2的新手,我有一个定制的CDN,可以在Angular应用程序中加载一些文件。我正在我的index.html中加载此CDN,并且所有文件都已正确加载,但它返回如下错误: Uncaught TypeError: undefined is not a function! at module.exports (_a-function.js:2) at module.exports (_ctx.js:4) at _array-methods.js:24 at Array.map (es

我是Angular 2的新手,我有一个定制的CDN,可以在Angular应用程序中加载一些文件。我正在我的
index.html中加载此CDN,并且所有文件都已正确加载,但它返回如下错误:

Uncaught TypeError: undefined is not a function!
at module.exports (_a-function.js:2)
at module.exports (_ctx.js:4)
at _array-methods.js:24
at Array.map (es6.array.map.js:8)
at Array.toArray (prototype.js:1074)
at module.exports (_iter-define.js:39)
at Object.<anonymous> (es6.array.iterator.js:11)
at __webpack_require__ (bootstrap 8d27006…:52)
at Object.<anonymous> (array.js:22)
at __webpack_require__ (bootstrap 8d27006…:52)
未捕获类型错误:未定义不是函数!
在module.exports(_a-function.js:2)
在module.exports(_ctx.js:4)
at_array-methods.js:24
在Array.map(es6.Array.map.js:8)
atarray.toArray(prototype.js:1074)
在module.exports(_iter-define.js:39)
反对。(es6.array.iterator.js:11)
at\uuuuu网页包\uuuuuuuuuuu需要(引导8d2706…:52)
反对。(array.js:22)
at\uuuuu网页包\uuuuuuuuuuu需要(引导8d2706…:52)
知道发生了什么吗?在
index.html
中加载CDN是否正确


谢谢

您一定认为Angular2使用的是TypeScript而不是JavaScript,因此当您尝试在来自Angular2项目的CDN中使用这些LIB时,编译器可能无法识别代码


顺便说一句,我也是Angular2的新手,但我相信这可能就是问题所在。

尝试在脚本标签上添加
defer
属性。谢谢,但是如果我使用
defer
属性,它会工作,但不会加载文件。没错,但从理论上讲,当您在
localhost:4200
中加载应用程序时,服务器会将TypeScript编译为JavaScript(我正在使用CLI工具和
ng service