在AngularJS应用程序中添加PolyFill.js [英] Add PolyFill.js in AngularJS application

查看:255
本文介绍了在AngularJS应用程序中添加PolyFill.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在将PowerBi JavaScript SDK嵌入angularJs App中. PowerBI Javascript SDK利用了Promise.

WE are embedding PowerBi JavaScript SDK in angularJs App. PowerBI Javascript SDK makes use of the Promise.

IE 11不支持Promises.很多帖子指示我要同时使用ployfill.js.

IE 11 do not support Promises. Lot of posts directed me to make use of ployfill.js for the same.

我的问题是如何在angularjs应用程序中注入PolyFill.js文件?

My Question is how do I Inject PolyFill.js file in angularjs app?

推荐答案

如果您使用Webpack进行捆绑,请在主输入脚本之前添加polyfill.js.

If you are using Webpack for bundling, add the polyfill.js before your main entry script.

module.exports = {
   entry: ['polyfill.js', './main.js']
};

如果您在html中使用脚本标记,请确保在任何其他使用promises(PowerBI)的库之前包含脚本:

If you are using script tags in html, make sure to include the script before any other library that uses promises (PowerBI):

<script src="path/to/polyfill.js"></script>

一种更模块化的方法是使用core-js并仅包含所需的polyfill:

A more modular approach is to use core-js and include only the polyfill you need:

module.exports = {
   entry: ['core-js/fn/promise', './main.js']
};

这篇关于在AngularJS应用程序中添加PolyFill.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆