本节咱们主要给你们介绍AngularJs如何调用Restful,实现数据的CRUD。前端
主要用到的技术:后端
后端:ASP.NET WebApi + SQLServer2008api
前端:AngularJs,Bootstrap3工具
主要用到的开发工具开发工具
后端:VisualStudio2013 + SQLServer2008测试
前端:WebStorm8spa
using System.Net.Http; using System.Web.Http; namespace AngularJs_WebApi_Server.Controllers { public class TestController : ApiController { public HttpResponseMessage Get() { return new HttpResponseMessage() { Content = new StringContent("我是经过Get请求的") }; } public HttpResponseMessage Post() { return new HttpResponseMessage() { Content = new StringContent("我是经过Post请求的") }; } public HttpResponseMessage Put() { return new HttpResponseMessage() { Content = new StringContent("我是经过Put请求的") }; } } }
测试Get请求http://localhost:31194/api/test3d
请输入咱们的请求地址和请求方式code
查看返回结果orm
测试Post请求http://localhost:31194/api/test
请输入咱们的请求地址和请求方式
查看返回结果
测试Put请求http://localhost:31194/api/test
请输入咱们的请求地址和请求方式
查看返回结果
(未完待续)