Angular 4应用程序无法在IE11和Edge上运行 [英] Angular 4 app not working on IE11 and edge

查看:88
本文介绍了Angular 4应用程序无法在IE11和Edge上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用angular 4应用程序,并且它在除IE11和edge之外的所有浏览器上均能正常工作,我检查解决方案并添加了es15支持,并添加了polyfills以支持IE,但仍然无法正常工作.

I am working on angular 4 app and its working fine on all browsers except IE11 and edge, I check for solutions and added es15 support and added polyfills to support IE but its still not working properly.

问题:第一次没有在IE上加载,并且在几次刷新后加载,但没有完全加载.

Issue : Not loading at first time on IE and loads after couple of refreshes but not fully.

我已经完成了此处

任何帮助都是有意义的

谢谢

推荐答案

尝试了不同的方法和模块后,我最终得到了以下解决方案,以使angular 4应用程序在所有浏览器上都兼容.

After trying different methods and modules I ended up with following solution to make angular 4 app compatible on all browsers.

* BROWSER POLYFILLS
*/

/** 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/weak-map';
import 'core-js/es6/set';
import 'core-js/es6/reflect';
import 'core-js/client/shim';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
import 'classlist.js';  // Run `npm install --save classlist.js`.

/** IE10 and IE11 requires the following to support `@angular/animation`. */
import 'web-animations-js';  // Run `npm install --save web-animations-js`.

/** ALL Firefox browsers require the following to support `@angular/animation`. **/
import 'web-animations-js';  // Run `npm install --save web-animations-js`.

/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone';  // Included with Angular CLI.

/***************************************************************************************************
* APPLICATION IMPORTS
*/

/* polyfill ie11 */
import 'core-js/es7/array';
import 'core-js/es7/reflect';

/**
 * Date, currency, decimal and percent pipes.
 * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
 */
// Run `npm install --save intl`.
import 'intl'; 
import 'intl/locale-data/complete.js';
import 'intl/locale-data/jsonp/en.js';

if (typeof SVGElement.prototype.contains == 'undefined') {
    SVGElement.prototype.contains = HTMLDivElement.prototype.contains;
}

根据您在项目上安装的模块,您可能需要一些其他的polyfill,例如一些图表和图形有时需要一些额外的配置.

You might need some other polyfills depending upon modules you have installed on your project like few charts and graphs needs some extra configurations sometime.

这篇关于Angular 4应用程序无法在IE11和Edge上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆