IE中的Angular App空页但可在Chrome中使用 [英] Angular App Empty Page in IE but works in Chrome
问题描述
我已经开始学习Angular 4
,并使用Angular CLI (NG New HelloWorld)
编写了默认应用程序.当我写ng serve
并浏览到http://localhost:4200/
时,该页面在Chrome
中加载正常,但是在IE-Edge
中,它打开为空白页面. IE的控制台窗口SCRIPT5022: Exception thrown and not caught
File: polyfills.bundle.js, Line: 859, Column: 36
中存在错误.
这是预期的吗?
I have started learning Angular 4
and wrote a default application using Angular CLI (NG New HelloWorld)
. When i write ng serve
, and browse to http://localhost:4200/
, the page loads fine in Chrome
, However in IE-Edge
, it opens up as an empty page. there is an error in the console window of IE which is SCRIPT5022: Exception thrown and not caught
File: polyfills.bundle.js, Line: 859, Column: 36
.
Is this expected?
Screenshot of Empty Page in Internet Explorer
Screenshot of How it loads in Chrome
推荐答案
Found my answer here: Angular4 Application running issues in IE11.
转到src/
文件夹下的polyfills.ts
文件,然后按照该文件中的说明,取消注释(如果没有这些行,则添加以下行):
Go to polyfills.ts
file under the src/
folder and then as per the instructions in that file, uncomment (or add if there aren't these lines) the following lines:
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
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';
最后的笔记
对于 core-js 的较新版本,您需要更改'…/es6/…'
到'…/es/…'
(例如:import 'core-js/es/symbol';
).
Final notes
For the newer versions of core-js you need to change the import
from '…/es6/…'
to '…/es/…'
(example: import 'core-js/es/symbol';
).
这篇关于IE中的Angular App空页但可在Chrome中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!