0

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

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

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

3
  • First question: Is it angularjs or angular. in case of angular - which version. In any case, you will need to find appropriate polyfill and add that in index.html page like any other script using <script> tag Commented Jul 24, 2018 at 6:09
  • this is angularjs and we are using version 1.4 Commented Jul 24, 2018 at 6:12
  • Please fix typo - polyfill.js Commented Jul 24, 2018 at 10:47

1 Answer 1

1

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

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

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>

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']
};
Sign up to request clarification or add additional context in comments.

2 Comments

Hello, I have included the Polyfill.js file in my code. I have downloaded the copy from path, github.com/stefanpenner/es6-promise. Per documentation it requires me to call function require('es6-promise/auto'); I have added the same in my angular-Controller. I am getting reference error. How to fix the same?
It should load before angular as an external script. Post your code please it very hard to help by guessing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.