在asp.net mvc项目中使用angularjs路由是否很好? [英] Is it good to use angularjs routing in asp.net mvc project ?

查看:84
本文介绍了在asp.net mvc项目中使用angularjs路由是否很好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,



如何在asp.net mvc 5项目中使用angularjs?最好在mvc项目中使用angularjs而不是使用razor syntexs。什么是asp.net mvc中的实时项目结构。请求帮助我。我不熟悉asp.net mvc和angularjs

解决方案

AngularJS只是一个用于Web应用程序中客户端编程的JavaScript库。另一方面,Razor语法是服务器端编程的框架。



他们在一起工作,为您的应用程序提供强大的架构。您可以使用Razor语法编写服务器端编程代码,并且要处理客户端的所有逻辑,您可以使用AngularJS。无论你是否使用AngularJS,Razor都会出现在MVC中。



要将库添加到Web应用程序,您应该在Web应用程序的head部分输入脚本元素。



 <  脚本    src   =  https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js  >  <   /   script  >  





它将包括AngularJS。即使您不这样做,您仍然可以通过在视图中编写Razor代码来运行应用程序,向用户提供数据。 AngularJS只会使客户端编程变得更简单,为什么不阅读文档 [ ^ ]?


如果您在绿色文件上启动项目我建议:

如果你没有对某些视图使用Razor或任何autorization东西,我认为没有使用ASP.NET MVC的感觉(它只是一个锅炉)。你可以从头开始一个项目,例如与yeoman。然后你就拥有了整个结构。



我有很好的经验:

http://yeoman.io/codelab.html [ ^ ]

Sir,

How can i use angularjs in asp.net mvc 5 project? and it is good to use angularjs in mvc project instead of using razor syntexs.? what is the real time project strucure in asp.net mvc. pleas help me. i am new to asp.net mvc and angularjs

解决方案

AngularJS is just a JavaScript library for your client-side programming in a web application. Razor syntax on the other hand is a framework for server-side programming.

They work together, on both sides to provide a robust architecture for your application. You can write the server-side programming code using Razor syntax, and to handle all of the logic on client-side you can use AngularJS. No matter, whether you use AngularJS or not, Razor would be there in MVC.

To add the library to your web application, you should enter the script element in head section of your web application.

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>



It would include the AngularJS for you. Even if you don't do so, you can still run the application, provide data to users, by writing the Razor code in your views. AngularJS would just make client-side programming a little simpler, why don't you read the documentation[^]?


If you start a project on the green filed I recommend:
If you do not use Razor or any autorization stuff for some views, I see no sens to use ASP.NET MVC (It would be only a "boiler"). You can start a project from scratch for example with yeoman. Then you have the whole structure.

I have good experience with:
http://yeoman.io/codelab.html[^]


这篇关于在asp.net mvc项目中使用angularjs路由是否很好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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