In ASP. net mvc, jQuery and angularjs are used together to transmit parameters and bind data. jqueryangularjs
This is required. On a list page, you can click the details button to bring the record's primary key value to another page.
On the other page, obtain the record data and then display the record data on the webpage.
First use an animation to demonstrate:
Yesterday I share the http://www.cnblogs.com/insus/p/7017737.html for the ng-click parameters passed by angularjs for the ng-click event parameters passed
The above is just to pass in a value in ng-click, but in ASP. net mvc, you also need to pass this value to another view, ASP. net mvc Transfer Parameters (model) http://www.cnblogs.com/insus/p/6148167.html
$ Scope. detail = function (code) {var objects = {}; 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 (function success (response) {if (response. data. success) {window. location. href = response. data. redirectUrl;} else {alert (response. data. predictionmessage) ;}, function error (error) {alert (response. error. data );});};Source Code
In ASP. net mvc, the Controller receives the parameter Action to obtain the database data:
Public ActionResult ClauseDetail () {if (TempData ["Pass"] = null) return RedirectToAction ("Clause", "Code "); var pass = TempData ["Pass"] as Pass; TempData ["Pass"] = pass; Clause c = new Models. clause (); c. code = pass. key. toString (); ClauseEntity ce = new ClauseEntity (); var model = ce. clauseByKey (c ). firstOrDefault (); return View (model );}Source Code
After obtaining data from the database, a model is provided to the view. The following describes how to pass the model of ASP. net mvc to angularjs ng-model:
Transfer and bind to #3.