简体   繁体   English

Angular如何支持Internet Explorer 9?

[英]How can Angular support Internet Explorer 9?

Recently, Angular team announced that they'll support Internet Explorer 9 and I wonder how it possible? 最近,Angular团队宣布他们将支持Internet Explorer 9,我想知道它是如何可能的?

I use AngularJS at the moment so I read a lot about Angular and try to practice a little. 我现在使用AngularJS,所以我读了很多关于Angular的内容并试着练习一下。 I was pretty sure that Angular can be more faster than AngularJS because it use new feature of EcmaScript 6 and new events. 我非常确定Angular可以比AngularJS更快,因为它使用了EcmaScript 6的新功能和新事件。 As far as i know, Internet Explorer doesn't provide this events and features at all. 据我所知,Internet Explorer根本不提供此事件和功能。

So, where is the trick? 那么,诀窍在哪里? How Angular can support IE9 without this new features? 如果没有这个新功能,Angular如何支持IE9? I know TypeScript can compile in ES3. 我知道TypeScript可以在ES3中编译。 But it can't add new features like new DOM events. 但它无法添加新的DOM事件等新功能。

You have to include angular2-polyfills.js ( or angular2-polyfills.min.js ) in your code for Angular 2 project. 您必须在Angular 2项目的代码中包含angular2-polyfills.js(或angular2-polyfills.min.js)。 ( current version Angular 2.0.1 beta ) (当前版本Angular 2.0.1 beta)

That library adds missing polyfills to the browsers. 该库将缺少的polyfill添加到浏览器中。

a polyfill (or polyfiller) is additional code which provides facilities that are not built into a web browser. polyfill(或polyfiller)是附加代码,它提供未内置到Web浏览器中的工具。 ... https://en.wikipedia.org/wiki/Polyfill ... https://en.wikipedia.org/wiki/Polyfill

They use something called es6 shim which basically adds es6 features to browsers that haven't implemented them yet. 他们使用一种名为es6 shim的东西,它基本上将es6功能添加到尚未实现它们的浏览器中。

However using es6 syntax is far from being the reason to why angular 2 is faster. 然而,使用es6语法远不是为什么角度2更快的原因。 The main reasons why Angular 2 is faster than 1 is because of the way the check for changes in the model (which checks less often), they removed features that are not too performant and because instead of using the DOM directly they use something called Virtual DOM. Angular 2快于1的主要原因是由于检查模型中的更改(检查次数较少)的方式,他们删除了性能不太高的功能,并且因为不是直接使用DOM而是使用称为Virtual的东西DOM。

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

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