简体   繁体   中英

Angular 4 doesn't work with IE 9

I'm trying to launch angular app (ng new "appname") with IE 9 but it only works when I reload page with open IE9 dev tools window

I added (uncomment) all necessary polyfills in polyfills.ts

Here is the video

Angular 4.2.4

Updated Thank you, Martin

Finally get it working with console-polyfill and with zonejs

<script type="text/javascript" src="inline.bundle.js"></script>
<script type="text/javascript" src="polyfills.bundle.js"></script>
<script type="text/javascript" src="zone.js"></script>
<script type="text/javascript" src="main.bundle.js"></script>

Looks like you are using console in your code (the problem is in main.bundle.js ). If you want to use it and support IE9 at the same time, you will need to add another polyfill for it.

You could use this one probably:

https://github.com/paulmillr/console-polyfill

I tried to create new app and build it, there is one usage of console and it is in the src/main.ts file, you could also check if there is console supported and use it only in that case:

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => 'console' in window ? console.log(err) : null);

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