0

We have an Asp.net MVC 5 web application with Angular 2

It supports Chrome/Firefox/Edge, but it fails to load in IE 11. It shows below error.

enter image description here

tsconfig:

{
  "compilerOptions": {
    "target": "es2015",   
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "types": []
  },
  "exclude": [
    "node_modules",
    "jspm_packages"
  ],
  "compileOnSave": true
}

Layout.cshtml:

<!-- 1. Load libraries -->
    <!-- Polyfill(s) for older browsers -->
    <script src="/node_modules/core-js/client/shim.min.js"></script>    
    <script src="/node_modules/zone.js/dist/zone.js"></script>    
    <script src="/node_modules/systemjs/dist/system.src.js"></script>
    <!-- 2. Configure SystemJS -->
    <script src="/systemjs.config.js"></script>
    <script>
        System.import('app').catch(function (err) { console.error(err); });
    </script>

Is there any way to make it work in IE10/IE11 ???

  • syntax error, suggests you are using code that IE11 doesn't like, in other words, probably some ES2015+ syntax that IE11 will never understand – Jaromanda X Sep 08 '17 at 06:56
  • Probably the below link will help you in solving the issue: https://stackoverflow.com/questions/35140718/angular-2-4-not-working-in-ie11 – Aravind Sep 08 '17 at 06:59
  • @Aravind Sorry, I am not using CLI starter pack for my application, so that won't help me. – Vigneshwaran Markandan Sep 08 '17 at 07:14

2 Answers2

1

The target version you are using for the compiler is producing code not supported by IE (ES2015). Change it to an older version.

tiagodws
  • 1,345
  • 13
  • 20
1

Replace your tsConfig code with below it should work

{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"types": [],
"lib": [ "es2015", "es2017", "dom" ]
},
"exclude": [
"node_modules"
],
"compileOnSave": true
}