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