Google AngularJS 框架 - 值得冒险吗?
我被要求为我们的一位客户构建一个小型 Web 应用程序,我认为这可能是尝试使用不同框架来构建 Web 应用程序的好机会。我们构建的大多数应用程序都基于 asp.net Web 表单,我们尚未在 MVC 架构中做任何事情,但我渴望开始使用正确的工具以更结构化的方式构建 Web 应用程序。
我一直在研究像 asp.net MVC 之类的东西,它们看起来相当不错,但我想知道使用像 Google AngularJS 框架这样的东西有什么可说的。
如果可能的话,我仍然希望能够使用 C# 编写我的服务器端代码,并且我还没有对 AngularJS 进行足够的研究,不知道这是否可能,尽管我假设我可以使用 Web 服务。
有没有人有使用 AngularJS 开发应用程序的经验,如果有的话,感觉如何?您能为我指出一些教程的正确方向吗?
I have been asked to build a small web application for one of our clients and think it might be a good opportunity to try out a different framework for building web applications. Most of the applications we build are based on asp.net web forms and we have no yet done anything in an MVC architecture but I am eager to start building web applications in a more structured manner with the right tools.
I have been researching things like asp.net MVC and the likes which look quite good but I am wondering is there anything to be said for using something like the Google AngularJS Framework.
If possible I would still like to be able to write my server side code using c# and I have not researched AngularJS enough to know if this is even possible, although I assume I could use web services.
Has anyone had any experience with developing an app using AngularJS and if so, how was it and can you point me in the right direction for some tutorials?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
过去几个月我们一直在 AngularJS 中开发 Swing 胖客户端应用程序的端口,我认为值得推荐。就学习资源而言,请查看官方项目网站(并务必阅读教程)和邮件列表(作者非常有帮助)。
好东西:
坏处是:
一些提示(如果您决定学习 AngularJS):
We have been developing a port of a Swing fat-client application in AngularJS for the last couple of months and I think it is worth recommending. As far as learning resources go, check out the official project site (and be sure to read the tutorial) and the mailing list (the authors are very helpful).
The good stuff:
The bad stuff:
Some pointers (if you ever decide to learn AngularJS):
+1 @psycho 的回答
AngularJS 是客户端框架,因此您可以在服务器上使用任何语言。它的设计目的是与 jQuery 很好地配合使用,重点是测试...
以下是一些您可能会发现有用的资源:
一些示例应用程序:
SenchaTouch 适配器:https://github.com/tigbro/sencha-touch-angular-adapter
适配器jQ Mobile:https://github.com/tigbro/jquery-mobile-angular-adapter< /a>
欢迎在邮件列表上提出任何问题!
我们仍然在Beta 版,但 Google 已经有几个由 AngularJS 提供支持的内部应用程序。
更新(2012 年 7 月 26 日):
AngularJS v1.0 已发布。
对于一些公共 AngularJS 支持的应用程序,请查看 http://builtwith.angularjs.org
+1 @psycho's answer
AngularJS is client-side framework, so you can use any language on the server. It's designed to work well together with jQuery, with big emphasis on testing...
Here are some resources you might find useful:
Some example apps:
Adapter for SenchaTouch: https://github.com/tigbro/sencha-touch-angular-adapter
Adapter for jQ Mobile: https://github.com/tigbro/jquery-mobile-angular-adapter
Feel free to ask any question on mailing list !
We are still in beta, but there are already several internal apps at Google, powered by AngularJS.
UPDATE (26th July 2012):
AngularJS v1.0 has been released.
For some public AngularJS-powered apps, check out http://builtwith.angularjs.org
恕我直言,为客户开发一些他们可能难以支持的东西是不专业的。您必须记住,您的客户将很难聘请经验丰富的 Angular 专业人员,或培训自己的人员来攀登“陡峭的学习曲线”。另外,到目前为止,文档还不是那么好。您能否在几分钟内轻松回答以下问题:“如何将闪亮的 Angular 应用程序连接到客户的数据库?”您的客户在未来的某个时候能否轻松获取一些现有代码并使其适应他们未来潜在的需求?说实话。
将普通的老式可靠 LAMP 开发与 Angular 进行比较。对于“小型网络应用程序”,我真的相信专业人士应该为他的客户提供可维护且简单的东西。
这并不是说 Angular 不酷、不性感等等。但是,除了最新的框架时尚之外,您还需要考虑客户未来的可维护性。我的建议是小心行事。首先使用 Angular 构建您自己的网站,然后看看您的想法,然后再将您出色的新技能授予一些值得信赖的客户。
IMHO developing something for a client which they may have difficulty supporting is unprofessional. You have to bear in mind that it will be difficult for your client to hire experienced Angular professionals, or train their own people to climb that "steep learning curve". Also, so far the documentation is not that great. Can you easily, in a few moments, answer the question, "How can I connect my shiny Angular app to my client's database?" Can your client sometime in the future easily grab some existing code and adapt it to their potential future needs? Be honest.
Compare plain old reliable LAMP development to Angular. For a "small web application" I really believe that a professional should give his client something maintainable and simple.
It's not to say that Angular isn't cool and sexy etc etc. But you have your client's future maintainability to think about in addition to the latest framework fad. Tread lightly would be my recommendation. Build your own website with Angular first and see what you think before you bestow your fabulous new skills on some trusting client.
我记得几个月前读过这个帖子,心里有同样的问题,我们决定继续使用 AngularJS,这是我们在这个项目上做出的最佳决定。
我们使用 AngularJS + ASP.NET MVC4 REST WebAPI。
最有可能的是,在有了这样一个不错的客户端 Javascript MVC 框架之后,您只需要 REST API 层与服务器端的业务逻辑层交互,而服务器端不需要 MVC(ASP.NET MVC/Spring/Structs 会感觉像是旧的记忆)。
您会发现 Angular-UI 很好的附加组件(esp ng-grid)
在我们的项目完成后不久,我们可能会放置一些我们为开源世界编写的指令。
I remember reading this SO thread couple of months back with same question in my mind, and we decided to go ahead with AngularJS, and the best decision we made on this project yet.
We are using AngularJS + ASP.NET MVC4 REST WebAPI.
Most probalbly after such a nice client side Javascript MVC framework, you would only need REST API layer interacting with Business Logic Layer at server side, and no MVC at server Side (ASP.NET MVC/Spring/Structs would feel like old memories).
You will find Angular-UI good add-on (esp ng-grid)
Soon after our project finishes, we might put some of our directive we wrote for open source world.
几个月来我一直在研究 AngularJS 的优点,以将其用作我正在创建的产品的核心框架。
AJS 有很多方面值得学习。是的,有一点学习曲线,但这是非常值得的,特别是如果您希望对客户端功能有更多的控制。
JQuery 在运行时操作 DOM,而 AJS 将自身置于 JS 渲染生命周期内。这允许您通过创建 HTML 元素和属性来教授 DOM 新技巧。这是非常非常强大的。因为您可以做的是根据您的目的和需要引入新的元素行为。在 AJS 中,这些自定义 HTML 属性/元素称为指令。凭借制定自己的指令的能力,您能够构建当前 HTML 所不具备的功能,从而推出可在现在和未来的所有现代浏览器上运行的功能。在诱导新行为的众多方法中,AJS 似乎是人们可以采取的最安全的方向,因为他们选择了实施它的方式。
AJS 中的性能比 JQuery 有巨大的提升。
我喜欢双向数据绑定的简单性,以及客户端 MVC 模式中的关注点分离,如上所述,这提供了很好的可测试性。范围对象是视图(HTML)、模型(您的数据)和自定义控制器之间的粘合剂。范围提供对父属性的访问,并且可以在同级级别进行隔离,这对于某些可重用模板非常重要。
可以在您的应用程序中创建和重用模板,其中可以包含 0 个或多个自定义指令。
我一直在使用 PRISM 和 MEF 等框架,但我发现 AJS 具有这些 .NET 框架中存在的大部分相同功能,但占用空间为 29K。有传言称他们正在研究延迟加载,如果提供的话将提供一些非常有趣的 LOB 类型功能。
有许多为 AJS 构建的 UI 框架,但只要付出一些努力,您就可以根据需要包装任何第 3 方控制库。诀窍是确保当这些第 3 方控件引起更改时,您确保使用其 apply 方法正确通知 AJS。
如果您在 VS 2012 中将 AJS 与 MS TypeScript 结合起来,它就提供了管理和构建一些非常令人印象深刻的项目的能力,这对于那些更熟悉 VS 中的项目的人来说将非常有用。
考虑 AJS 还有很多其他原因,但如果您正在考虑 KnockOut 等框架,我强烈推荐 AJS,无论它的学习曲线如何。 Knockout是一个库,AJS是一个框架。
I have been researching the merits of AngularJS for many months to utilize as a core framework for product I am creating.
There are many aspects of AJS that make it worth while to learn. Yes there is a bit of a learning curve but its well worth it, especially if you wish to have more control on client side capability.
JQuery manipulates the DOM at run time, whereas AJS situates itself within the JS rendering lifecycle. This allows you to teach the DOM new tricks by creating your HTML Elements and Attributes. This is very, very powerful. As what you are able to do is introduce new Element behaviors for whatever your purpose and need. In AJS these custom HTML Attributes/Elements are called Directives. With the ability to craft your own Directives, you are able to build functionality that the current HTML doesn't have, pushing out capabilities that will run on all modern browsers now and into the future. Of the many approaches to inducing new behavior, AJS appears to be the safest direction one could take due to how they have chosen to implement it.
There is a huge performance gain over JQuery in AJS.
I love the simplicity of the two-way data binding, and the separation of concerns in their client side MVC pattern, which as pointed out above provide great testability. There scope object is the glue between the View (HTML), the Model (your Data) and your custom Controllers. The scope provides access to parent attributes and can be isolated at the sibling level, which is important for some reusable templates.
Templates can created and reused across your application which can contain 0 or more custom directives.
I have been using frameworks such as PRISM and MEF but I am finding that AJS has most of the same features that exist in these .NET frameworks but in a 29K footprint. There is rumors that they are working on lazy-loading which if provided will provide for some very interesting LOB type capabilities.
There are a number of UI frameworks that are being built for AJS but you can wrap any 3rd party control lib as needed, given a bit of effort. The trick is to ensure that when these 3rd party controls have changes induced, that you ensure AJS is properly notified using their apply method.
If you combine AJS with MS TypeScript within VS 2012, it provides the ability to manage and build some very impressive projects which will work well for those who are more comfortable with projects within VS.
There are a ton of other reasons to look at AJS, but if you are considering frameworks such as KnockOut I'd highly recommend AJS instead, regardless of it's perceived learning curve. Knockout is a library, AJS is a framework.
到目前为止,我认为 Google 的 Angular 很棒。特别是数据绑定和依赖注入。
对于其他js框架,还有knockout.js、backbone.js等。
这里有一些帖子:
backbone.js 和/或淘汰赛中的 angular.js 示例.js
So far i think Google's Angular is great. Particular like the databinding and dependency injection.
For other js framework, there are knockout.js , backbone.js etc.
here are some posts:
angular.js example in backbone.js and/or knockout.js
我意识到这篇文章已经很旧了,而且你还没有使用 Angular,但我和你有相似的背景,而且在问这个问题时我和你的观点是一样的。
因此,为了未来访问者的利益,我发现一些有用的“风险”和资源链接...
最后,我找到了学习这些东西的三个最佳资源
I realise this post is old and you haven't gone with Angular, but I have a similar background to you, and I'm at the same point as you when asking the question.
So for the benefit of future visitors, some of the "risks" and links to resources I've found useful...
And finally, the three best resources I've found for learning this stuff
我对此表示同意,并查看 John Papa 的 hottowel 实现作为一种实现方式。
I would say yes to this and check out John Papa's hottowel implementation as a way to do it.