要求是这样子的,在一个列表页中,用户点击详细铵钮,带记录的主键值至另一页。
在另一外页中,获取记录数据,然后显示此记录数据在网页上。
先用动图演示:
昨天有分享为ng-click传递参数 《http://www.cnblogs.com/insus/p/7017737.html
上面仅仅是在ng-click传入一个值,但是在ASP.NET MVC中,还需要把这个值传至另外一个视图中《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); }); };