当与Meteor结合使用时,AngularJS可以做什么,Handlebars不能做到?

时间:2021-10-20 17:06:07

I am considering using AngularJS instead of Handlebars with MeteorJS. I am more familiar with AngularJS, but it doesn't work well out-of-the-box with Meteor. Handlebars is default templating engine used in MeteorJS.

我正在考虑使用AngularJS代替Handlebars和MeteorJS。我对AngularJS更熟悉,但它与Meteor的开箱即用效果不佳。 Handlebars是MeteorJS中使用的默认模板引擎。

I would like to know the trade-off between the two, e.g., whether AngularJS provides more flexible front-end coding than Handlebars.

我想知道两者之间的权衡,例如,AngularJS是否提供比Handlebars更灵活的前端编码。

My question is: when pairing with Meteor, what AngularJS can do that Handlebars can not in terms of front-end programming?

我的问题是:当与Meteor配对时,AngularJS可以做什么,Handlebars在前端编程方面无法做到?

(Note that people love AngularJS in part b/c of its two-way binding and data model, but Meteor-Handlebars do these very well too).

(请注意,人们喜欢AngularJS在其双向绑定和数据模型的b / c部分,但Meteor-Handlebars也非常好)。

Update: Please do not vote to close this question if you think it is a duplicate of another question in SO that compares Angular and Handlebars. Meteor added significant power to Handlebars due to its "database on client" approach.

更新:如果您认为它与SO中另一个比较Angular和Handlebars的问题重复,请不要投票关闭此问题。由于其“客户端数据库”方法,Meteor为Handlebars增加了巨大的力量。

5 个解决方案

#1


7  

Angular and Meteor can be combined, and it's a pretty neat combo. Angular's templating system and its two-way bindings (DOM to JS model) can even be made to go the whole way and be kept in sync with a Meteor collection. Such a pairing of Angular and Meteor means you get instantaneous DOM to database syncing, which is very cool. Angular can't do that by itself, nor can Meteor (without writing more or less tedious event handlers) and even less Handlebars.

角度和流星可以组合,它是一个非常整洁的组合。 Angular的模板系统及其双向绑定(DOM到JS模型)甚至可以在整个过程中与Meteor集合保持同步。这样的Angular和Meteor配对意味着您可以获得即时DOM到数据库同步,这非常酷。 Angular不能单独做到这一点,Meteor也不能(没有编写更多或更少乏味的事件处理程序)甚至更少的Handlebars。

The angular-meteor Meteor package is pretty much ngMeteor's successor (it builds on ngMeteor code) and integrates Meteor collections with Angular models, the two templating systems, Meteor Session variables etc.

角度流星Meteor包几乎是ngMeteor的继承者(它建立在ngMeteor代码上),并将Meteor集合与Angular模型,两个模板系统,Meteor Session变量等集成在一起。

#2


6  

TL;DR: Meteor works best with packages (think jQuery, bootstrap, d3, underscore, stylus, less) since they enhance a framework. Those same packages would enhance Angular too (well, kind of). Angular is an end-to-end framework, so trying to integrate it on top of another end-to-end framework like Meteor is a recipe for headaches.

TL; DR:Meteor最适合包(想想jQuery,bootstrap,d3,下划线,手写笔,更少),因为它们增强了框架。那些相同的包也会增强Angular(好吧,有点)。 Angular是一个端到端的框架,所以试图将它集成在另一个像Meteor这样的端到端框架之上是令人头疼的问题。

Handlebars has very similar expressions and bindings that you're probably familiar with in Angular. But while the templating engine is similar, it's the rest of the frameworks that differ greatly.

Handlebars具有非常相似的表达式和绑定,您可能在Angular中熟悉它们。但是虽然模板引擎类似,但其余的框架差别很大。

Angular leans heavily on its internal directives (ng-repeat, ng-form, ng-bind, etc.) to easily tie in javascript (i.e. power) to your markup. There's a lot of magic behind the scenes.

Angular严重依赖其内部指令(ng-repeat,ng-form,ng-bind等),以便轻松地将javascript(即电源)绑定到您的标记。幕后有很多魔力。

Meteor leans heavily on the pub/sub model and connecting to your true data stores. Their secret sauce comes from easily adding but abstracting packages (handlebars is one of their default packages, but some others are bootstrap, accounts-ui, d3, etc.).

Meteor严重依赖于pub / sub模型并连接到您真正的数据存储。他们的秘诀来自于轻松添加但是抽象包(把手是他们的默认包之一,但其他一些是bootstrap,accounts-ui,d3等)。

Meteor follows very different ideologies and has different opinions on framework design than Angular does. In my opinion, Meteor's are superior though the project is still in its relative infancy. You'll find that Meteor is really, really good at prototyping quickly, especially if you need to tie in user support and want to use Twitter/Facebook/Google.

Meteor遵循非常不同的意识形态,对框架设计的看法与Angular不同。在我看来,尽管该项目仍处于相对初级阶段,但Meteor仍然优越。你会发现Meteor真的非常非常擅长快速进行原型设计,特别是如果你需要配合用户支持并希望使用Twitter / Facebook / Google。

You'd be better off choosing one or the other, but if you're not strong on the server side, you could write a pretty slick Meteor app to just act as your API server.

你最好选择其中一个,但如果你在服务器方面不够强大,那么你可以编写一个非常流畅的Meteor应用程序来充当你的API服务器。

#3


4  

If you want to use angularjs with meteor you can just install a package that does that. Then you can use both meteor and angular.

如果你想将angularjs与meteor一起使用,你可以安装一个这样做的包。然后你可以使用流星和角度。

Meteor is realy nice for getting your data from server to client, angular is very nice in getting that data displayed (and stable).

Meteor非常适合从服务器到客户端获取数据,angular非常适合显示数据(并且稳定)。

mrt add angular-stack

or

要么

mrt add ngMeteor

#4


3  

Generally speaking, AngularJS has passed the version 1.0 milestone and is considered ready for production use while meteor is still alpha software. Consequently, Angular is more polished, has directives, modules and rich third-party libraries like AngularUI.

一般来说,AngularJS已经通过版本1.0里程碑,并且被认为可以用于生产,而meteor仍然是alpha软件。因此,Angular更加精致,具有指令,模块和丰富的第三方库,如AngularUI。

But if you feel like experimenting with a bleeding-edge framework, don't think you'll have to do super-fancy templating-stuff but need a database built in, go with Meteor!

但是,如果你想尝试一个前沿的框架,不要认为你必须做超级模仿的东西,但需要一个内置的数据库,与Meteor一起使用!

#5


0  

I think you might find this answer helpful.

我想你会发现这个答案很有帮助。

Also I think it might be a duplicated question.

我认为这可能是一个重复的问题。

#1


7  

Angular and Meteor can be combined, and it's a pretty neat combo. Angular's templating system and its two-way bindings (DOM to JS model) can even be made to go the whole way and be kept in sync with a Meteor collection. Such a pairing of Angular and Meteor means you get instantaneous DOM to database syncing, which is very cool. Angular can't do that by itself, nor can Meteor (without writing more or less tedious event handlers) and even less Handlebars.

角度和流星可以组合,它是一个非常整洁的组合。 Angular的模板系统及其双向绑定(DOM到JS模型)甚至可以在整个过程中与Meteor集合保持同步。这样的Angular和Meteor配对意味着您可以获得即时DOM到数据库同步,这非常酷。 Angular不能单独做到这一点,Meteor也不能(没有编写更多或更少乏味的事件处理程序)甚至更少的Handlebars。

The angular-meteor Meteor package is pretty much ngMeteor's successor (it builds on ngMeteor code) and integrates Meteor collections with Angular models, the two templating systems, Meteor Session variables etc.

角度流星Meteor包几乎是ngMeteor的继承者(它建立在ngMeteor代码上),并将Meteor集合与Angular模型,两个模板系统,Meteor Session变量等集成在一起。

#2


6  

TL;DR: Meteor works best with packages (think jQuery, bootstrap, d3, underscore, stylus, less) since they enhance a framework. Those same packages would enhance Angular too (well, kind of). Angular is an end-to-end framework, so trying to integrate it on top of another end-to-end framework like Meteor is a recipe for headaches.

TL; DR:Meteor最适合包(想想jQuery,bootstrap,d3,下划线,手写笔,更少),因为它们增强了框架。那些相同的包也会增强Angular(好吧,有点)。 Angular是一个端到端的框架,所以试图将它集成在另一个像Meteor这样的端到端框架之上是令人头疼的问题。

Handlebars has very similar expressions and bindings that you're probably familiar with in Angular. But while the templating engine is similar, it's the rest of the frameworks that differ greatly.

Handlebars具有非常相似的表达式和绑定,您可能在Angular中熟悉它们。但是虽然模板引擎类似,但其余的框架差别很大。

Angular leans heavily on its internal directives (ng-repeat, ng-form, ng-bind, etc.) to easily tie in javascript (i.e. power) to your markup. There's a lot of magic behind the scenes.

Angular严重依赖其内部指令(ng-repeat,ng-form,ng-bind等),以便轻松地将javascript(即电源)绑定到您的标记。幕后有很多魔力。

Meteor leans heavily on the pub/sub model and connecting to your true data stores. Their secret sauce comes from easily adding but abstracting packages (handlebars is one of their default packages, but some others are bootstrap, accounts-ui, d3, etc.).

Meteor严重依赖于pub / sub模型并连接到您真正的数据存储。他们的秘诀来自于轻松添加但是抽象包(把手是他们的默认包之一,但其他一些是bootstrap,accounts-ui,d3等)。

Meteor follows very different ideologies and has different opinions on framework design than Angular does. In my opinion, Meteor's are superior though the project is still in its relative infancy. You'll find that Meteor is really, really good at prototyping quickly, especially if you need to tie in user support and want to use Twitter/Facebook/Google.

Meteor遵循非常不同的意识形态,对框架设计的看法与Angular不同。在我看来,尽管该项目仍处于相对初级阶段,但Meteor仍然优越。你会发现Meteor真的非常非常擅长快速进行原型设计,特别是如果你需要配合用户支持并希望使用Twitter / Facebook / Google。

You'd be better off choosing one or the other, but if you're not strong on the server side, you could write a pretty slick Meteor app to just act as your API server.

你最好选择其中一个,但如果你在服务器方面不够强大,那么你可以编写一个非常流畅的Meteor应用程序来充当你的API服务器。

#3


4  

If you want to use angularjs with meteor you can just install a package that does that. Then you can use both meteor and angular.

如果你想将angularjs与meteor一起使用,你可以安装一个这样做的包。然后你可以使用流星和角度。

Meteor is realy nice for getting your data from server to client, angular is very nice in getting that data displayed (and stable).

Meteor非常适合从服务器到客户端获取数据,angular非常适合显示数据(并且稳定)。

mrt add angular-stack

or

要么

mrt add ngMeteor

#4


3  

Generally speaking, AngularJS has passed the version 1.0 milestone and is considered ready for production use while meteor is still alpha software. Consequently, Angular is more polished, has directives, modules and rich third-party libraries like AngularUI.

一般来说,AngularJS已经通过版本1.0里程碑,并且被认为可以用于生产,而meteor仍然是alpha软件。因此,Angular更加精致,具有指令,模块和丰富的第三方库,如AngularUI。

But if you feel like experimenting with a bleeding-edge framework, don't think you'll have to do super-fancy templating-stuff but need a database built in, go with Meteor!

但是,如果你想尝试一个前沿的框架,不要认为你必须做超级模仿的东西,但需要一个内置的数据库,与Meteor一起使用!

#5


0  

I think you might find this answer helpful.

我想你会发现这个答案很有帮助。

Also I think it might be a duplicated question.

我认为这可能是一个重复的问题。