AngularJs calls restful implementations Crud-angularjs

Source: Internet
Author: User

This section focuses on how ANGULARJS calls restful and implements data crud.

The main technology used:

Backend: ASP. WebApi + SQLServer2008

Front End: ANGULARJS,BOOTSTRAP3

The main development tools used

Back end: VisualStudio2013 + SQLServer2008

Front End: WEBSTORM8

1. Create a back-end project angularjs_webapi1.1 Create an empty solution name Angularjs_webapi

1.2 Creating a Angularjs_webapi_server service-side project

1.3 Select an empty WEBAPI project and create

1.4 New Controller TestController Class (for testing)

1.5 Writing TestController.cs Implementation code
Using System.Net.Http;Using System.Web.Http;Namespace angularjs_webapi_server.controllers{  PublicClass Testcontroller:apicontroller{  Public Httpresponsemessage Get () {   ReturnNew Httpresponsemessage ()  {   Content =New Stringcontent ("I was requested by get ")  }; }  Public Httpresponsemessage Post () {   ReturnNew Httpresponsemessage ()  {   Content =New Stringcontent ("I was requested by post ")  };  }  public Httpresponsemessage Put ()   {  Span class= "indent" > return new httpresponsemessage ()    {    Content = new stringcontent ( I was requested by put ")   }; }}}           /span>                

1.6 Test The service you just posted with Chrome app Rest Console (if it's not available to download in the store)

To test a GET request http://localhost:31194/api/test

Please enter our request address and request method

View returned results

test the POST request http://localhost:31194/api/test

Please enter our request address and request method

View returned results

Test put request http://localhost:31194/api/test

Please enter our request address and request method

View returned results

(not to be continued)

AngularJs calls restful implementations Crud-angularjs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.