简体   繁体   中英

Angular 4 not rendering properly on IE 11

I am trying to get my Angular app work properly on IE.
Its building on IE but not rendering properly.

For Example :

  1. CSS styles not applied properly
  2. Colors applied to SVG using style tags are missing
  3. *ngIf applied to divs not working
  4. Using {{typescript variable}} in HTML doesn't display text in few places and many more

Angular Version: 4.1.0

Please note : I tried running it with add on polyfills like shim for client but nothing worked for me.

I could finally get this working by adding a polyfill for IE by following these steps :

  1. Run npm install --save classlist.js which adds classlist to your node_modules and dependency automatically gets added in package.json like this : "classlist.js":"^1.1.20150312"
  2. Add import 'classlist.js'; to polyfills.ts file.

More information on missing polyfills for browser compatibilty for angular can be found here https://angular.io/guide/browser-support

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM