jquery and Angularjs mixed application and binding data in ASP.

Source: Internet
Author: User

The requirement is this, in a list page, the user clicks on the Detailed ammonium button, with the recorded primary key value to another page.
On another external page, get the record data, and then display this record data on the Web page.

First, use the dynamic diagram to demonstrate:

Yesterday there was a share for Ng-click pass parameter "Angularjs for Ng-click event pass parameter" http://www.cnblogs.com/insus/p/7017737.html


The above is just passing in a value in Ng-click, but in ASP. NET MVC, you also need to pass this value to another view in the ASP. NET MVC pass parameter (model) http://www.cnblogs.com/insus/p/6148167.html

$scope. Detail =function(code) {varobjects = {}; Objects. Key=Code; Objects. Value= ""; Objects. Controller= "Code"; Objects. Action= "Clausedetail"; $http ({method:' POST ', URL:'/pass/redirect ', DataType:' JSON ', headers: {' Content-type ': ' Application/json; Charset=utf-8 '}, Data:JSON.stringify (objects),}). Then (functionSuccess (response) {if(response.data.Success) {window.location.href=Response.data.RedirectUrl; }                     Else{alert (response.data.ExceptionMessage); }                 },                functionError (Error) {alert (response.error.data);        }); };
Source Code

The action receive parameter in the controller of the ASP. NET MVC gets the data for the database:

  PublicActionResult Clausedetail () {if(tempdata["Pass"] ==NULL)                returnRedirecttoaction ("Clause","Code"); varpass = tempdata["Pass"] asPass; tempdata["Pass"] =Pass; Clause C=NewModels.clause (); C.code=Pass.            Key.tostring (); Clauseentity CE=Newclauseentity (); varModel =CE. Clausebykey (c).            FirstOrDefault (); returnView (model); }
Source Code


After fetching the data from the database, give the view a model. Here is the focus of this article, how to pass the model of ASP. Angularjs Ng-model:

Pass and bind in # #.

ASP. jquery and Angularjs Mix application and bind data

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.