本文介绍了谷歌的 Polymer 是一个功能齐全的前端框架来替代或补充其他前端框架吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题与 AngularJS、BackboneJS、EmberJS 和其他框架有关.

我必须将一个项目从 php 翻译成 javascript,我必须决定是否要使用:

  1. AngularJS
  2. 聚合物
  3. 它们的组合

我更喜欢使用 Polymer,因为我喜欢它.

然而,我缺少(并纠正我的错误)能力:

  1. 视图和它们之间的链接(如在 Angualar 中)
  2. 控制器

我知道结构取决于我,关于如何构建我的应用程序,但似乎 angularjs 具有用于构建 mvc 应用程序的预定义结构.

因此我想知道:Polymer 是否是 Angular 的替代品,如果您想构建一个结构良好的 Web 应用程序,或者是 Polymer 补充 库与其他库一起使用现有框架?

编辑 21.09.2014没有人真正回答了我最满意的问题,因此我将其标记为尚未回答.许多人说这只是取决于".但是没有人能够详细说明它究竟取决于什么.

关于应用程序的复杂性?关于应用程序的需求?聚合物适合哪些需求,不适合哪些需求?这些是我一直在寻找的答案.

有人说它可以用作前端框架.其他人说那只是一个图书馆,其他人说是和否".不幸的是,答案相当混乱.

我希望有一个官方的答案,但我让你说出我的感受.我相信它是一种替代品,但 Polymer 尚未达到其他框架需要工作的结构.也许这是故意的,也许只是未达到成熟度的问题,因为框架是新的.

我希望创建者能解释一下,什么时候最好使用 AngularJS,什么时候应该使用 Polymer 来构建大型可扩展的 Web 应用程序.

编辑 15.08.2015

聚合物 1.0 已发布.事实证明,Polymer 正式不是一个框架,应该以互补的方式与其他前端框架一起工作.https://youtu.be/fD2As5RmM8Q?t=6m42s

解决方案

恕我直言,两者都是不同的东西,它们都服务于两个不同的目的.尽管它们提供了一些共同的功能,但数据绑定可以是其中之一.

聚合物

如果您真的想使用 Awesome Webcomponents,Polymer 是实现这一目标的一种方式.还有其他选项,例如您可以使用 vanilla JS,或使用其他库,例如来自 Mozilla 的 X-TagBosonic.这些库填充了仍处于草稿状态的 webcomponent 功能.因此,这些库帮助我们在浏览器之间拥有/提供相同的用户体验,即使在没有对 web 组件的本机支持的情况下也是如此.

角度

这是一个成熟的 MVC 框架.这里的人们知道 Angular 作为 MVC 框架包含/提供什么.

这一切都是为了回答你的问题

Google 的 Polymer 并不是一个功能齐全的前端框架,可以用作其他前端框架的替代或补充.它可以作为 MVC 替代 Angular 中的 V 部分.就像人们在不同的框架中使用 React 作为 V 一样.这对我来说没什么不同.更具体地说,在 Angular 的情况下,Polymer 就像 Angular 1.x 中的 directives 而就像即将到来的 Angular 2.x 中的 components.

参考资料

为了更确定我在说什么,以及关于如何将 Polymer 与 Angular2 一起使用的其他来源(Angular2 目前尚未发布)

所以,在我看来,这两个项目并不相互竞争.

Web 组件规范

webcomponent 规范在这里供人们参考

我只希望 Web 组件尽快成为 常绿浏览器 的本地组件.

The question is in regard to AngularJS, BackboneJS, EmberJS and the other frameworks.

I have to translate a project from php to javascript and I have to decide, if I am going to use:

  1. AngularJS
  2. Polymer
  3. A combination of them

I prefer using Polymer, because I like it.

Yet, I am missing (and correct me where I am wrong) the ability to make:

  1. Views and link between them (like in Angualar)
  2. Controllers

I know that the structure is up to me, on how to build my application, but it seems that angularjs has a well predefined structure for building mvc-applications.

Therefore I want to know: Is Polymer a substitute for Angular, if you want to build a well structured web application or is Polymer complementary library to be used along other existing frameworks?

EDIT 21.09.2014No one really answered the question to my fullest satisfaction, therefore I marked it as not answered yet. Many say it just "DEPENDS". But no one is able to elaborate, on what exactly it depends.

On the complexity of the application? On the needs of the application? For what needs does Polymer fit and for which doesn't it fit? These are the answers I was looking for.

Some say it can be used as a frontend framework. Others say that is just a library and others say "Yes and No". Unfortunately rather confusing answers.

I wish there was an official answer to this, but I let you in on what my feeling is. I believe it is a substitute, but Polymer hasn't yet reached the structure, that other frameworks require to work. Maybe this is intentional, maybe it is just a matter of unreached maturity, because the framework is new.

I hope that the creators will explain, when it is best to use AngularJS and when should someone use Polymer for building large scalable web applications.

EDIT 15.08.2015

Polymer 1.0 is out. And it turns out Polymer is officially NOT a framework and is supposed to work in a complentary way with other frontend frameworks.https://youtu.be/fD2As5RmM8Q?t=6m42s

解决方案

IMHO both are two different things and they both are to serve two different purposes. Though they have some common features to offer, data-binding can be one of them.

Polymer

If you truly want to use the Awesome Webcomponents, Polymer is one way to achieve that. There are other options like you can go with your vanilla JS, or use other libraries like X-Tag from Mozilla or Bosonic. These libraries polyfill the webcomponent features which are still in drafted state. So, these libs help us have/provide the same user experience across browsers even where there is no native support for the webcomponents.

Angular

This is a full fledged MVC framework. And people here know what Angular as an MVC framework includes/provides.

That all said to answer your question

Google's Polymer is not exactly a fully functioning Frontend Framework and can be used as a Subsitute OR Complement to other Frontend Frameworks. It can be used as a substitution for the V part in Angular as MVC. Like people use React as V in different frameworks. It is not much a different case for me. Being more specific in case of Angular, Polymer is like directives in Angular 1.x while like components in upcoming Angular 2.x.


References

To be more sure of what I am talking about and for additional sources on how to use the Polymer with Angular2 (Angular2 not released to this date)

So, in my view these two projects are not competing each other.


Webcomponent Specs

The webcomponent specs are here for one's reference

I just wish the webcomponents are native to the evergreen browsers ASAP.

这篇关于谷歌的 Polymer 是一个功能齐全的前端框架来替代或补充其他前端框架吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 21:59