混合角和ASP.NET MVC /网页API? [英] Mixing Angular and ASP.NET MVC/Web api?

查看:196
本文介绍了混合角和ASP.NET MVC /网页API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我来自使用ASP.NET MVC /网络API,现在我开始使用角度,但我不能用正确的方法清楚地混合。

I come from using ASP.NET MVC/Web API and now I am starting to use Angular but I am not clear on the proper way to mix them.

在我使用的角度也对MVC切断侧概念仍然提供了什么价值?或者我应该严格是使用Web API纯粹是为了获取数据的角度HTTP调用?

Once I am using Angular does the MVC sever side concepts still provide any value ? Or should I strictly be using Web API purely to get data for the angular HTTP calls ?

您有什么秘诀了ASP.NET MVC的家伙过渡到角将是有益的。

Any tips you have for a ASP.NET MVC guy transitioning to Angular would be helpful

推荐答案

纯Web API

我曾经是pretty铁杆的ASP.NET MVC但因为我见过角我不明白为什么我会使用的任何的服务器端内容生成框架的一个原因。纯角/ REST(的WebAPI)给出了一个更丰富,更平滑的结果。它的速度更快,让你建立网站来相当接近桌面应用程序,无需任何时髦的黑客。

I used to be pretty hardcore with ASP.NET MVC but since I've met Angular I do not see one reason why I would use any server side content generation framework. Pure Angular/REST(WebApi) gives a richer and smoother result. It's much faster and allows you to build websites that come quite close to desktop applications, without any funky hacks.

角确实有一点点的学习曲线,但一旦你的团队已经掌握了它,你会在较短的时间打造更好的网站。这主要是必须做的事实,你没有这些状态(少)的问题了。

Angular does have a little learning curve, but once your team has mastered it, you'll build much better websites in less time. Mainly this has to do with the fact that you don't have all these state(less) issues anymore.

例如想象的向导形式的与任何传统的服务器端框架。每个页面都需要进行验证,并单独提交。也许页面的内容依赖于从一个previous页的值。也许用户pressed后退按钮,并重新提交previous形式。我们在哪里存储客户端的状态?采用了棱角分明休息时所有这些并发症是不存在的。

For example imagine a wizard form with any traditional server side framework. Each page needs to be validated and submitted separately. Maybe the content of the page is dependent on values from a previous page. Maybe the user pressed the back button and is re-submitting an previous form. Where do we store the state of the client? All these complications do not exist when using Angular and REST.

所以...过来黑暗的一面......我们已经得到了饼干。

So ... come over to the dark side ... we've got cookies.

<一个href=\"http://stackoverflow.com/questions/20989024/actual-use-of-jade-template-and-angularjs/20990498#20990498\">Similar问题

这篇关于混合角和ASP.NET MVC /网页API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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