Angular 2 / 4 / 5 not working in IE11

后端 未结 22 2092
野的像风
野的像风 2020-11-22 11:07

I am trying to figure out why my angular 2 app is stuck on showing Loading... when running in IE 11.

Following someone\'s suggestion, I\'ve tried this plunker, poste

相关标签:
22条回答
  • 2020-11-22 11:41
    1. Un-comment some imports in the polyfill.ts file.

    /** 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';

    Install npm Pacakages Notice there are some npm install commands in the comments. If you are using an early version of Angular CLI, there may also be a third one. For Angular CLI versions 7, 6, and 1.7 you need to run:

    npm install --save classlist.js

    npm install --save web-animations-js

    now open IE and render your application and check :)

    0 讨论(0)
  • 2020-11-22 11:42

    I have an Angular4 application, even for me also it was not working in IE11 browser, i have done below changes, now its working correctly. Just add below code in the index.html file

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    Just you need to uncomment these below lines from polyfills.ts file

    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';
    

    These above 2 steps will solve your problem, please let me know if anything will be there. Thanks!!!

    0 讨论(0)
  • 2020-11-22 11:45

    I had the exact same issue and none of the solutions worked for me. Instead adding the following line in the (homepage).html under <head> fixed it.

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    
    0 讨论(0)
  • 2020-11-22 11:46

    How to resolve this problem in Angular8

    polyfills.ts uncomment import 'classlist.js'; and import 'web-animations-js'; then install two dependency using npm install --save classlist.js and npm install --save web-animations-js.

    update tsconfig.json with "target":"es5",

    then ng serve run the application and open in IE, it will work

    0 讨论(0)
  • 2020-11-22 11:47

    You'll need to adjust the polyfills.ts file for your target browsers by uncommenting the appropriate sections.

    /** 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';
    
    0 讨论(0)
  • 2020-11-22 11:48

    The latest version of core-js lib provides the polyfills from a different path. so use the following in the polyfills.js. And also change the target value to es5 in the tsconfig.base.json

    /** IE9, IE10 and IE11 requires all of the following polyfills. **/
    import 'core-js/es/symbol';
    import 'core-js/es/object';
    import 'core-js/es/function';
    import 'core-js/es/parse-int';
    import 'core-js/es/parse-float';
    import 'core-js/es/number';
    import 'core-js/es/math';
    import 'core-js/es/string';
    import 'core-js/es/date';
    import 'core-js/es/array';
    import 'core-js/es/regexp';
    import 'core-js/es/map';
    
    0 讨论(0)
提交回复
热议问题