1. 找到

polyfill.ts 并打开注释

/*** This file includes polyfills needed by Angular and is loaded before the app.* You can add your own extra polyfills to this file.** This file is divided into 2 sections:*   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.*   2. Application imports. Files imported after ZoneJS that should be loaded before your main*      file.** 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.** Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html*//**************************************************************************************************** BROWSER POLYFILLS*/// 兼容ie10
(function() {Object.setPrototypeOf = Object.setPrototypeOf || ({__proto__: []} instanceof Array ? setProtoOf : mixinProperties);function setProtoOf(obj, proto) {obj.__proto__ = proto;return obj;}function mixinProperties(obj, proto) {for (const prop in proto) {if (!obj.hasOwnProperty(prop)) {obj[prop] = proto[prop];}}return obj;}
})();/** 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';/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js';  // Run `npm install --save classlist.js`./** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';/*** Web Animations `@angular/platform-browser/animations`* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).**/
// import 'web-animations-js';  // Run `npm install --save web-animations-js`./*** By default, zone.js will patch all possible macroTask and DomEvents* user can disable parts of macroTask/DomEvents patch by setting following flags*/// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames/** in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js* with the following flag, it will bypass `zone.js` patch for IE/Edge*/
// (window as any).__Zone_enable_cross_context_check = true;/**************************************************************************************************** Zone JS is required by default for Angular itself.*/
import 'zone.js/dist/zone';  // Included with Angular CLI.import 'babel-polyfill';
/**************************************************************************************************** APPLICATION IMPORTS*/

  

1.如果IE10报错

ERROR Error: Uncaught (in promise): TypeError: 对象不支持“setPrototypeOf”属性或方法
TypeError: 对象不支持“setPrototypeOf”属性或方法at EmptyError (http://localhost:4200/vendor.js:71276:9)at Anonymous function (http://localhost:4200/vendor.js:66133:471)at complete (http://localhost:4200/vendor.js:69444:17)at TapSubscriber.prototype._complete (http://localhost:4200/vendor.js:69197:13)at Subscriber.prototype.complete (http://localhost:4200/vendor.js:61281:13)at Subscriber.prototype._complete (http://localhost:4200/vendor.js:61299:9)at Subscriber.prototype.complete (http://localhost:4200/vendor.js:61281:13)at Subscriber.prototype._complete (http://localhost:4200/vendor.js:61299:9)at Subscriber.prototype.complete (http://localhost:4200/vendor.js:61281:13)at MergeMapSubscriber.prototype._complete (http://localhost:4200/vendor.js:66792:13)at resolvePromise (http://localhost:4200/polyfills.js:12176:25)at resolvePromise (http://localhost:4200/polyfills.js:12133:17)at Anonymous function (http:/",Symbol(rxSubscriber)_m.kuj7accbtog: undefined,task: { },zone: { }}

  则引入一下代码到 polyfills.ts 顶部

(function() {Object.setPrototypeOf = Object.setPrototypeOf || ({__proto__: []} instanceof Array ? setProtoOf : mixinProperties);function setProtoOf(obj, proto) {obj.__proto__ = proto;return obj;}function mixinProperties(obj, proto) {for (const prop in proto) {if (!obj.hasOwnProperty(prop)) {obj[prop] = proto[prop];}}return obj;}
})();

  

如果ie9报错

SCRIPT5007: 缺少对象
polyfills.js (11361,23868)
SCRIPT5009: “Promise”未定义
vendor.js (31760,1)

  则注销掉 此段 代码

// import 'web-animations-js';  // Run `npm install --save web-animations-js`.

  

最后在index.html中添加 如下两个插件

<script src="https://cdn.bootcss.com/es5-shim/4.5.12/es5-sham.min.js"></script><script src="https://cdn.bootcss.com/classlist/2014.01.31/classList.min.js"></script>

ps:

如果项目中有上传文件 浏览文件的操作,需要对ie进行单独兼容 ie 不支持File对象

并且ie9 不支持FormData 对象

转载于:https://www.cnblogs.com/MainActivity/p/10383882.html

angular6、7 兼容ie9、10、11相关推荐

  1. js监听浏览器关闭事件(区分刷新和关闭,兼容IE9,10,11,Edge,Chrome和Firefox)

    由于各浏览器兼容性不同,所以首先要先区分各浏览器 var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 var isOpera = use ...

  2. React支持IE9/10/11

    create-react-app(自搭)脚手架支持IE9/10/11 create-react-app以及自搭的脚手架支持IE9/10/11 create-react-app做法 自搭脚手架做法 cr ...

  3. IE浏览器兼容9/10/11版本(针对老项目而言)

    对于老项目只支持IE7/8/9搞后台的朋友,不用太担心兼容是前端人员搞得事儿了,我们也可以.之前也是花了近两周的时间在网上找了各种资料,什么最简单的兼容方法啊还是一行代码教你解决此类问题等等...多数 ...

  4. osx java 6_OSX 10.11 java 6不兼容怎么办?OSX 10.11 java 6不兼容解决办法

    OSX 10.11 java 6不兼容怎么办?有很多用户在使用最新的OSX 10.11系统时会发现java SE 6不兼容的问题,其实要解决 这个问题比较简单,用户需要下载安装最新的Java SE 8 ...

  5. 如何说服老板页面兼容IE9+

    从以下数据看,我们的页面兼容IE9+是可行的. 注:浏览器市场份额占比,数据来自百度统计(http://tongji.baidu.com/data/browser)和StatCounter(http: ...

  6. react16 兼容ie9

    需求: 使用react 做了一个基础的框架,写了一堆代码之后发现ie 的用户占比还是比较高的于是要做ie 的兼容 本来想要兼容ie 8以上,但是好像有点困难,改成兼容ie9 进程: 创建一个react ...

  7. php5.6.16,OSX 10.11 中重新编译PHP5.6.16问题

    想把OSX 系统自带的PHP升级了,关了系统防护,在编译PHP的时候由于需要openssl,而OSX10.11并没有带openssl的头文件,比较郁闷,按openssl默认方式编译后的路径在 /use ...

  8. 兼容iOS 10 资料整理笔记

    1.Notification(通知) 自从Notification被引入之后,苹果就不断的更新优化,但这些更新优化只是小打小闹,直至现在iOS 10开始真正的进行大改重构,这让开发者也体会到UserN ...

  9. 2017年6月Mac OS 10.11安装文档

    [2017年6月4日] Mac OS X 10.11(EI Capitan)之所以不能用U盘安装,是因为制作为安装盘后的大小接近8GB,而我最大的U盘实际容量只有7.6GB左右,所以只能选择硬盘安装. ...

  10. VMware 安装Mac os 10.11 苹果系统

    闲来无事,突然就想要体验体验苹果系统,但是windows系统用着比较顺手,又不想直接买Mac book,就想起来vmware这款强大的虚拟机,但是虚拟机里面默认是没有苹果系统的,这时候需要激活,接下来 ...

最新文章

  1. 厉害了,如何通过双 key 来解决缓存并发问题?
  2. 信息系统运维安全管理规定(可作为范文参考)
  3. 大道至简第一章阅读笔记
  4. 实现GridView的插入功能
  5. mysql noinstall 安装_mysql-noinstall安装指南
  6. 【CodeForces - 202A】LLPS (思维,字符串)
  7. Hive参数性能调优
  8. vue中使用ts后,父组件获取执行子组件方法报错问题
  9. paip.提升用户体验---c++ ide 自动化注释插件的开发...
  10. POJ 2976 裸的01分数规划
  11. 如何把java控件添加代码_JAVA 添加控件问题 代码如下 很简单的一个程序 在线等 Thanks...
  12. Matlab实现的数学模型(2020新整理)
  13. 华为云服务器手机密码找回,忘记华为账号密码怎么办?两招就能帮你解决
  14. DM达梦DSC共享集群+DW(单机)
  15. FPGA内部资源结构——以Altera CycloneⅣ 为例
  16. echarts结合百度地图实现迁徙图效果
  17. 1153: 简易版最长序列
  18. 高薪、高收入程序员背后全是辛酸泪!熬夜,作息饮食不规律,体重增加,掉头发,黑眼圈,生病,鼠标手,颈椎病,免疫力下降?
  19. 哈佛大学凌晨4点半的景象--哈佛图书馆的二十条训言
  20. KVM和Xen的区别

热门文章

  1. 计算机设备硬件设备,计算机硬件设备有哪些
  2. 搭建Maven环境及其基本知识
  3. PrintStream 打印流、System 剖析、Java 16 进制转换
  4. 今天突然出现了Property IsLocked is not available for Login '[sa]',我太阳,下面有绝招对付它!...
  5. 到爱尔兰敲代码 / Come, Coding in Ireland
  6. java篇 之 多态
  7. [HNOI2014]世界树
  8. VC CUtilityLZW 效率还行的LZW压缩算法,随机数加密
  9. java基础学习及总结
  10. 第十七章 特殊成员_使用typedef简化函数指针的声明