如果我使用 Meteor,为什么还需要 Angular? [英] Why would I need Angular if I use Meteor?

查看:24
本文介绍了如果我使用 Meteor,为什么还需要 Angular?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Angular 对于构建单页应用程序非常有用.它基本上建立在我们向不同端点发出请求以帮助我们创建更好的单页应用程序的当前范式之上.

Angular is really useful for building single page applications. It is basically built on the current paradigm where we make requests to different endpoints to help us create better single page applications.

另一方面,我们有 Meteor,它看起来更强大,特别是因为它们有一个称为 DDP 的功能,它基本上允许双向数据流.Meteor 似乎是 Angular 的超集,显然是更好的选择.

On the other hand, we have Meteor which seems even more capable, especially since they have a feature called DDP which basically allows bi-directional data streaming. It seems like Meteor is a superset of Angular and is the obvious better choice.

虽然 Angular 确实提供了一些整洁的东西,比如测试和本地化,但我只是不明白为什么我要把 Angular 与 Meteor 结合使用,而不是只使用 Meteor.如果我要使用 Meteor,有人可以解释为什么我想要使用 Meteor 进行 Angular,甚至使用任何 MV* 前端框架吗?

While Angular does offer some neat things like testing and localization, I just don't see why would I use Angular with Meteor as opposed to just using Meteor. Could someone explain why I would want to Angular with Meteor or even use any MV* front-end framework if I were to use Meteor?

推荐答案

两者略有不同.日常工作中最明显的是绑定.

There are slight differences in the two. The most apparent to everyday work would be the binding.

在 Meteor 中,它有点像 Angular,但没有此绑定,因为您必须手动执行此操作.如果您使用 angular,它可以自动绑定到您的 html,那么 Meteor 可以更进一步,将其推送到服务器和其他所有人.

In Meteor its a bit like having Angular but without this binding, since you have to manually do it. If you use angular it can bind to your html automatically, then Meteor can take this one step further and push it to the server and to everyone else.

Meteor 也有测试,但它是非官方的.您必须从大气.meteor.com 安装软件包才能使用此额外功能.那里还有很多其他东西.

Meteor does have testing too but its unofficial. You would have to install packages off atmosphere.meteor.com to use this extra functionality. There's lots of other stuff on there too.

要记住的一件事是 Meteor 有一个名为 Meteor-UI 的新模板引擎正在开发中,它解决了当前 angular 实现中存在的许多问题.主要的一个是 DOM 隔离.关于它的更多详细信息:https://github.com/meteor/meteor/wiki/New-Template-Engine-Preview

One thing to keep in mind is Meteor has a new Templating engine in the works called Meteor-UI which addresses a lot of the concerns which the current implementation which angular has a leg up on. The main one would be DOM isolation. More details on it here: https://github.com/meteor/meteor/wiki/New-Template-Engine-Preview

新的 Meteor-UI 模板引擎实际上比 angular 更进一步,因为引入了控件"的新概念.这意味着您可以使用类似把手的代码添加一个文本框,并让它通过验证自动绑定到事件和后端.

The new Meteor-UI template engine actually goes a step further than angular since a new concept of 'controls' are introduced. This means you can add a textbox in with handlebars-esque like code and have it automatically bind to events and to the backend, with validation.

通过本地化,有一个大气包可以帮助解决这个问题.您可以使用车把占位符并根据您打算显示的语言替换它们.

With localization there is a package on atmosphere that helps a bit with that. You can use handlebars placeholders and replace them depending on the language you intend to display.

这也取决于您的偏好,如果您习惯使用 Angular,它可以创建感觉非常原生的漂亮应用程序.Meteor 也以不同的方式执行此操作,目前由于绑定需要做更多的工作,但由于 Meteor-UI,它会在接下来的一两个月内发生变化.

It also depends on your preference, if you're comfortable with using Angular, it can create beautiful apps that feel very native. Meteor also does this in a different way, at the moment it does take a bit more work because of the binding but it would change in the next month or two because of Meteor-UI.

这篇关于如果我使用 Meteor,为什么还需要 Angular?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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