Angular2 IE11 Unable to get property 'apply' of undefined or null reference

后端 未结 11 1262
终归单人心
终归单人心 2020-12-07 22:41

I am getting the following error after upgrading my angular2 packages to the following versions:

  • @angular/common\": \"^2.3.1
  • @angular/compiler\": \"^
相关标签:
11条回答
  • 2020-12-07 23:10

    It seems angular-cli(v1.0.0-rc.0) has file called polyfills.ts in which you have to un-comment all required polyfills for the browsers, It works good for me with zero installation in IE-11.

    0 讨论(0)
  • 2020-12-07 23:13

    if anyone got this error in a dotnet core 2.0 Angular template using IE, this is how I resolved it.

    1. install core-js

      npm install core-js --save

    2. Add this line at the top of ClientApp/boot.browser.ts

      import 'core-js/client/shim';

    0 讨论(0)
  • 2020-12-07 23:15

    To Work in IE browser

    Step 1:Run:npm i mdn-polyfills --save

    Step 2: Open polyfills.ts

    Step 3: UnComment the imports in the file under /** IE9, IE10 and IE11 requires all of the following polyfills. **/

    0 讨论(0)
  • 2020-12-07 23:16

    Stas Berkov is correct, and his answer led me to a slightly different solution:

    In my header where I load all the Angular scripts I included shim.js. (I bundle/minified on deploy). Big note: it is critical that shim.js be loaded before zone.js, otherwise you get a different error.

    <script src="/<my domain>/node_modules/core-js/client/shim.js"></script>
    <script src="/<my domain>/node_modules/zone.js/dist/zone.js"></script>
    <script src="/<my domain>/node_modules/reflect-metadata/Reflect.js"></script>
    <script src="/<my domain>/node_modules/systemjs/dist/system.src.js"></script>
    
    <script src="/<my domain>/systemjs.config.js"></script>
    
    0 讨论(0)
  • 2020-12-07 23:17

    Angular 4 IE11 fix for unable to get property 'apply'

    Step 1 : Open app/boot-browser-ts

    Step 2 : add the below line

    import 'core-js/client/shim'; 
    
    0 讨论(0)
提交回复
热议问题