简体   繁体   English

Angular 4不适用于IE 9

[英]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 我正在尝试使用IE 9启动Angular应用程序(ng新的“ appname”),但仅当我使用打开的IE9开发工具窗口重新加载页面时,它才有效

I added (uncomment) all necessary polyfills in polyfills.ts 我在polyfills.ts中添加了(取消注释)所有必要的polyfills

Here is the video 这是视频

Angular 4.2.4 角4.2.4

Updated Thank you, Martin 更新谢谢马丁

Finally get it working with console-polyfill and with zonejs 最终使其与console-polyfill和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 ). 看起来您在代码中使用console (问题出在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. 如果要同时使用它并支持IE9,则需要为其添加另一个polyfill。

You could use this one probably: 您可能会用到它:

https://github.com/paulmillr/console-polyfill 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: 我尝试创建并构建新应用,有一种console用法,它在src/main.ts文件中,您还可以检查是否支持console ,并且仅在这种情况下使用它:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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