This section describes how AngularJs calls Restful to implement CRUD of data.
The main technologies used:
Backend: ASP. NET WebApi + SQLServer2008
Front-end: AngularJs, Bootstrap3
Mainly used development tools
Backend: VisualStudio2013 + SQLServer2008
Front-end: WebStorm8
1. Create backend project AngularJs_WebApi 1.1 create an empty solution name AngularJs_WebApi
1.2 create an AngularJs_WebApi_Server server project
1.3 select an empty WebApi project and create
1.4 create a controller TestController class (for testing)
1.5 compile the implementation code of TestController. cs.
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 ("I requested through Get ")};} public HttpResponseMessage Post () {return new HttpResponseMessage () {Content = new StringContent ("I requested via Post") };} public HttpResponseMessage Put () {return new HttpResponseMessage () {Content = new StringContent ("I requested through Put ")};}}}
1.6 test the service just released through the Chrome application REST Console (if not, download it from the App Store)
Test Get requestHttp: // localhost: 31194/api/test
Enter our request address and Method
View returned results
Test Post requestHttp: // localhost: 31194/api/test
Enter our request address and Method
View returned results
Test Put requestHttp: // localhost: 31194/api/test
Enter our request address and Method
View returned results
(To be continued)