有什么优点和使用创造高分子定制的HTML5元素/小工具的利弊相比,AngularJS [英] What are the pros and cons of creating custom HTML5 elements/widgets using in Polymer compared to AngularJS

查看:164
本文介绍了有什么优点和使用创造高分子定制的HTML5元素/小工具的利弊相比,AngularJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道它是可以创建自定义的HTML5元素/在 AngularJS 部件创建的指令的。

I know it is possible to create custom HTML5 elements/widgets in AngularJS by creating directives.

最近,我一直在寻找到聚合物。另一种框架,使创建自定义元素容易为好。然而,聚合物使用本地HTML5 API,如在 ShadowDOM ,它AngularJS没有。

I recently been looking into Polymer. Another framework that makes creating custom elements easy as well. However, Polymer uses native HTML5 APIs like the ShadowDOM, which AngularJS doesn't.

请注意:我只是想创建自定义元素/部件的最新浏览器

Note: I am only thinking of creating custom elements/widgets for the latest browsers.

看起来既像AngularJS和聚合物可以做这项工作。但什么是两个库的利弊?

It looks like both AngularJS and Polymer can do the job done. But what are the pros and cons of the two libraries?

推荐答案

聚合物利用的自定义元素以创建HTML新的元素。这是被添加到浏览器的一个新的W3C规范。这样做的好处是,该API比JavaScript库相当于一个本地浏览器,并可能更高性能的。

Polymer utilizes the Custom Elements to create new elements in HTML. This is a new W3C specification being added to the browsers. The benefit is that the API is native to the browser and potentially more performant than a JavaScript library equivalent.

角指令是概念上类似于自定义元素,但他们与自定义JavaScript来实现。他们不使用标准的API ...在自定义元素存在已创建。角已经表示,他们将转向的规格,像影子DOM,定制元素等的未来。

Angular directives are conceptually similar to Custom Elements but they're implemented with custom JavaScript. They don't use a standard API...having been created before Custom Elements existed. Angular has said they'll move to using the specifications like Shadow DOM, Custom Elements, etc. in the future.

我也回答了角与聚合物之间的差异更深入的<一个href=\"http://stackoverflow.com/questions/18089075/what-is-the-difference-between-polymer-elements-and-angularjs-directives/18092637#18092637\">What是高分子元素和AngularJS指令?

I've also answered the differences between Angular and Polymer more in depth at What is the difference between Polymer elements and AngularJS directives?

这篇关于有什么优点和使用创造高分子定制的HTML5元素/小工具的利弊相比,AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆