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.ExceptionMessage); } }, function error(error) { alert(response.error.data); }); };
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); }
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:
The above is a small series of ASP. in net mvc, The jQuery and angularjs hybrid applications transmit parameters and bind data. I hope this will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!