2017-05-08 71 views
-1

我的angular 4应用程序能够在不同的浏览器中完美地工作。当运行在Internet Explorer版本11任意角4的应用,得到以下两个错误,同时启动应用程序:使用IE11的Angular4应用程序中的SCRIPT1014和SCRIPT1002错误

SCRIPT1014: Invalid character 
addScript.js (9,1) 

SCRIPT1002: Syntax error 
main.bundle.js (52,1) 

请需要帮助来解决这个问题。先谢谢你。 注意:我已经尝试过使用Angular 2的垫片解决方案,它并没有真正起作用,即shims_for_IE。请让我知道如果不同,我需要处理它。 enter image description here

我现在的填充工具:

import 'core-js/es6/symbol'; 
import 'core-js/es6/object'; 
import 'core-js/es6/typed'; 
import 'core-js/es6/function'; 
import 'core-js/es6/parse-int'; 
import 'core-js/es6/parse-float'; 
import 'core-js/es6/number'; 
import 'core-js/es6/math'; 
import 'core-js/es6/string'; 
import 'core-js/es6/date'; 
import 'core-js/es6/array'; 
import 'core-js/es6/regexp'; 
import 'core-js/es6/map'; 
import 'core-js/es6/set'; 
import 'core-js/es6/reflect'; 
import 'core-js/es7/reflect'; 
import 'zone.js/dist/zone'; 
+0

任何快速解决方案将非常有帮助。 – Arindam

回答

0

为了Angular应用程序在所有的浏览器工作,你可以使用Polyfill

当您使用Angular-CLI生成项目时,它已随附一个包含必需polyfills的文件。您可以在src/polyfill.ts名称下找到该文件。

只要打开这个文件,并取消您需要的行(它们是有据可查的,他们描述了其浏览器需要该polyfill),一旦它的完成,再次生成项目,迫使你的浏览器上IE11+ Compatibility mode运行,你准备好了。

+0

我的polyfills.ts文件位于下方。请让我知道,如果我应该包括或删除: import'core-js/es6/symbol'; import'core-js/es6/object'; import'core-js/es6/typed'; import'core-js/es6/function'; import'core-js/es6/parse-int'; import'core-js/es6/parse-float'; import'core-js/es6/number'; import'core-js/es6/math'; import'core-js/es6/string'; import'core-js/es6/date'; import'core-js/es6/array'; import'core-js/es6/regexp'; import'core-js/es6/map'; import'core-js/es6/set'; import'core-js/es6/reflect'; import'core-js/es7/reflect'; import'zone.js/dist/zone'; – Arindam

0

我有一个SCRIPT1002类似的问题:语法错误main.bundle.js。

我的polyfill.ts文件是一样的。我最终通过添加一个空白div来编辑index.html文件,然后保存html文件,然后删除div,然后再保存它。保存HTML文件角度cli后重新加载,它与IE11的工作。

相关问题