Angular.js和ASP.NET MVC 4 [英] Angular.js and ASP.NET MVC 4
问题描述
我有一个ASP.NET MVC 4项目,我被困在一个架构决策上的JavaScript框架或库使用Angular.js或Knock.js。我目前倾向于使用Angular.js超过Knockout.js,但不希望项目在开发过程中我犯了一个错误,找出中间。
I have an ASP.NET MVC 4 project and I'm stuck on an architectural decision on which JavaScript framework or library to use Angular.js or Knock.js. I am currently leaning towards using Angular.js over Knockout.js, but don't want to find out midway during project development I made a mistake.
下面是一些背景:
- 我们需要双向的模型数据结合
- 我们需要测试的观点的能力。我希望能够做到端到端的单元测试。此外,我们使用持续集成。
- 保存更改功能。即如果用户使得我们需要检测的任何变化,并提示用户他们从页面导航离开之前保存其变化的能力在页面上修改
- 通知功能。即,用户将被记录在约8小时,将需要通知和更新由其他用户(错误,数据状态的变化等) 进行的修改
- 我们需要面向未来我们的应用程序。目前,该事业部还没有决定,如果我们需要支持移动设备,但我知道这只是一个时间问题。
- 我们的团队由开发人员从很初级不同经验水平到高级开发人员。
- 目前,我们的模型很复杂,可能会得到更应如此
- 我们还需要考虑RAD,code重用性和可维护性
我已经阅读了出色答卷<一个href=\"http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-emberjs-or-other-client-mvc-frameworks-if-i-have\">here看着斯科特·艾伦的关于这里角采访
I have read the excellent answer here and watched Scott Allen's interview about Angular here
由于我们无法从我们目前的ASP.NET MVC 4架构改变为在服务器端如Web API使用的东西,我有一些的关切,努力实现与MVC 4 Angular.js这是否会导致我们有两个车型之一的服务器上,一个在客户机上的?
Since we are unable to change from our current ASP.NET MVC 4 architecture to use something on the server side like Web API I have some concerns in trying to implement Angular.js with MVC 4. Will this cause us to have two models one on the server and one on the client?
我不是在寻找有关角和淘汰赛了哪个更好的讨论,因为我觉得他们都有自己的优点和缺点。我要找就执行一个ASP.NET MVC应用4 JavaScript框架或库实际code。我需要的,我可以用2年,从现在住的解决方案:)
I am not looking for a "which is better" discussion about Angular and Knockout because I think they both have their pros and cons. I am looking for actual code on implementing a JavaScript framework or library in an ASP.NET MVC 4 application. I need a solution that I can live with 2+ years from now :)
任何意见或建议?或许答案不是敲或角,但其他一些JavaScript框架?
Any ideas or suggestions? Maybe the answer is not Knock or Angular, but some other JavaScript framework?
推荐答案
很高兴看到这个问题是社区感兴趣的;)只是为了完整性这里是我落得这样做:
Glad to see this questions was of interest to the community ;) Just for completeness here's what I ended up doing:
我与AngularJS和ASP.NET MVC 4去,很高兴我做到了。虽然,角有一个陡峭的学习曲线,但它的价值,因为指令的力量吧。
I did go with AngularJS and ASP.NET MVC 4 and was glad that I did. Although, Angular has a steep learning curve but its worth it because of the power of directives.
- 我们需要双向模型数据绑定 - 在occassion我需要设置从MVC控制器来一些初始值。我用了NG-INIT属性来实现这一目标。
- 我们需要测试的意见的能力 - 我跟着 AngularJS文档测试
- 保存更改的功能 - 我实现了这个用角指令
- 通知功能 - 我实现了这个使用toastr.js和和指令(schweet)
- 我们需要面向未来我们的应用程序 - 我不知道谷歌的AngularJS计划,但AngularJS工作后,我无法看到它去任何地方很快,并希望它变得更广泛采用:)
这篇关于Angular.js和ASP.NET MVC 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!