• [转]Angular 2 / 4 / 5 not working in IE11


    本文转自:https://stackoverflow.com/questions/35140718/angular-2-4-5-not-working-in-ie11/47777695#47777695

    The latest version of angular is only setup for evergreen browsers by default...

    The current setup is for so-called "evergreen" browsers; the last versions of browsers that automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 
    This also includes firefox, although not mentioned.

    See here for more information on browser support along with a list of suggested polyfills for specific browsers. https://angular.io/guide/browser-support#polyfill-libs


    This means that you manually have to enable the correct polyfills to get Angular working in IE11 and below.


    To achieve this, go into polyfills.ts (in the src folder by default) and just uncomment the following imports:

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

    Note that the comment is literally in the file, so this is easy to find.

    If you are still having issues, you can downgrade the target property to es5 in tsconfig.json as @MikeDub suggested. What this does is change the compilation output of any es6 definitions to es5 definitions. For example, fat arrow functions (()=>{}) will be compiled to anonymous functions (function(){}). You can find a list of es6 supported browsers here.

    For me with iexplorer 11 and Angular 2 I fixed all those above issues by doing 2 things:

    in index.html add:

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

    in srcpolyfills.ts uncomment:

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




    https://angular.io/guide/quickstart
  • 相关阅读:
    用gethub下载ardupilot的最新源码
    Mavlink协议理解
    Mavlink消息包解析
    Mavlink 协议 理解
    极飞P20农业无人机多机协同作业飞行
    如何下载最新的固件到Pixhawk
    韦东山笔记之用busybox构建根文件系统
    Visual studio 打包程序时添加自定义的系统必备组件
    MFC 编译链接错误:unresolved external symbol
    在Visual studio 2017中使用EF6连接MySQL
  • 原文地址:https://www.cnblogs.com/freeliver54/p/9669103.html
Copyright © 2020-2023  润新知