10

I can't figure out what is the problem in IE11.
App works well without any issue in other browsers like chrome, firefox etc.


enter image description here

micronyks
  • 54,797
  • 15
  • 112
  • 146

3 Answers3

18

You need to include es6-shim because IE 11 doesn't support Map.prototype.keys

https://github.com/paulmillr/es6-shim

Or you can import directly from cdn:

<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.4.1/es5-shim.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.1/es6-shim.js"></script>

Check this related issues:

Ruan Mendes
  • 90,375
  • 31
  • 153
  • 217
Joel Almeida
  • 7,939
  • 5
  • 25
  • 51
  • This solution fixed this error. But raised new error `The use of a keyword for an identifier is invalid` which still seems open issue @ https://github.com/angular/angular/issues/6501 – micronyks Feb 16 '16 at 10:55
  • in the linked issue, there is a suggested script as a work-around: https://github.com/angular/angular/blob/master/modules/angular2/src/testing/shims_for_IE.js – Michael Kang Feb 16 '16 at 14:26
1

"The use of a keyword for an identifier in invalid" on IE 11 is still an issue for Angular2 beta 6:

http://github.com/angular/angular/issues/6501

In the thread, there is a work-around that seems to work:

// function.name (all IE)
/*! @source http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie*/
if (!Object.hasOwnProperty('name')) {
  Object.defineProperty(Function.prototype, 'name', {
    get: function() {
      var matches = this.toString().match(/^\s*function\s*(\S[^\(]*)\s*\(/);
      var name = matches && matches.length > 1 ? matches[1] : "";
      // For better performance only parse once, and then cache the
      // result through a new accessor for repeated access.
      Object.defineProperty(this, 'name', {value: name});
      return name;
    }
  });
}
Michael Kang
  • 52,003
  • 16
  • 103
  • 135
0

I came across the same error when using webpack and 2.0.0.rc1.

If anyone have the same problem, here is how I made it work.

Basically I included on index.html the scripts

es6-shim.min.js
system-polyfills.js
shims_for_IE.js

when the browser is IE or Safari.

Community
  • 1
  • 1
SebaGra
  • 2,801
  • 2
  • 33
  • 43