Search code examples
angularinternet-explorerinternet-explorer-11polyfills

IE 11 compatibility errors using Angular 5


I have build my Angular application then run it in server.

I got errors that where not shown in localhost.

Unable to get property 'onHover' of undefined or null reference.

File Chart.min.js, ligne : 10, colonne : 115187

Error “SCRIPT 1028 Expected identifier, string or number”

File polyfills.bundle.js, ligne : 6399, colonne : 5 .

Object doesn't support property or method 'querySelector

File styles.bundle.js, ligne : 215, colonne : 2

Expected identifier

File: vendor.bundle.js, ligne : 3169, colonne : 23

I have uncommente imports in polyfills.ts

/** 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 'classlist.js';  // Run `npm install --save classlist.js`.
import 'core-js/es7/reflect';

// import 'web-animations-js';  // Run `npm install --save web-animations-js`.
import 'zone.js/dist/zone';  // Included with Angular CLI.

Here's network trafic when loading app

enter image description here


Solution

  • Add meta tag in the index.html. This is also a necessary line.

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