微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

angular项目兼容IE浏览器

前言

图书馆的项目最近想要放到钉钉上使用,但是项目放到微信公众号上可以访问,放到钉钉上却不可以用,刚开始很疑惑为什么会这样呢,后来才知道钉钉的内核是IE内核,把项目放到电脑上的IE浏览器中也是不可以访问的。知道了为什么,接下来就好办了,那就是解决呗。

叙述

其实angular项目如何兼容IE浏览器,项目中已经告诉我们了,打开angular自动生成polyfill.ts文件,你可以看到这样的内容

/*************************************************************************************************** * 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';
  import 'babel-polyfill';
 import 'classlist.js';
 import 'web-animations-js';
/** 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 to support `@angular/animation`. */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.

/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';

/** ALL Firefox browsers require the following to support `@angular/animation`. **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.

/*************************************************************************************************** * Zone JS is required by Angular itself. */
import 'zone.js/dist/zone';  // Included with Angular CLI.

/*************************************************************************************************** * APPLICATION IMPORTS */

/** * Date,currency,decimal and percent pipes. * Needed for: All but Chrome,Firefox,Edge,IE11 and Safari 10 */
// import 'intl'; // Run `npm install --save intl`.

对于文件中import在干什么,你仔细看每一行代码后面的注释就知道了。解释的非常的详细。
这里有一个小注意点,有两个依赖需要你手动安装:
npm install –save classlist.js
npm install –save web-animations-js
文件中过的这两个引用打开,然后进行安装,就可以在IE浏览器中访问了。

小结

很简单的解决方法,一定要去尝试哦。

感谢您的阅读~~

原文地址:https://www.jb51.cc/angularjs/144509.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐