Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add URL Polyfill in Angular App

We would like to use https://github.com/auth0/angular2-jwt in our application. And right now it says, Internet Explorer 11 support requires a URL polyfill. Need help or steps in order to add this polyfill in the Angular App.

like image 917
Nehal Damania Avatar asked Mar 23 '18 12:03

Nehal Damania


Video Answer


2 Answers

The official documentation describes the necessary steps.

What you must do is:

  1. install the npm package
  2. import the file in polyfills.ts
like image 36
ForestG Avatar answered Sep 23 '22 13:09

ForestG


  1. Ensure you have the Angular CLI in your computer installed globally if you don't already:

    npm install -g @angular/cli
    
  2. cd to your project root (the directory with package.json in)

  3. Install the URL polyfill (the --save adds the polyfill to your package.json file):

    npm install url-polyfill --save
    
  4. Open the Angular polyfills.ts file and after the line with "/** IE10 and IE11 requries..." add this line:

    import 'url-polyfill';
    
like image 90
Dai Avatar answered Sep 23 '22 13:09

Dai