如何将表ID传递到另一个页面AngularJS

时间:2018-09-04 03:15:05

标签: angularjs asp.net-mvc parameter-passing

在此项目表中基于db表的数据生成。我的loan.html如下,

<form role="form" class="form-horizontal" name="LoanParaDataForm">
    <div class="container">
        <div class="box-body">
            <div class="form-group">
                <div class="col-sm-12">
                    <div class="table-responsive">
                        <table id="example5" class="table table-striped table-bordered" cellspacing="0" width="100%" datatable="ng">
                            <thead>
                                <tr>
                                    <th>Applied Date</th>
                                    <th>Loan ID</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="x in approvedLoanList">
                                    <td>{{ x.APPLIED_DATE }}</td>
                                    <td>{{ x.ID }}</td>
                                    <td>
                                        <input onclick="location.href='@Url.Action("UnsuccessLoan", "LoanDetails")'" type="button" class="btn btn-danger" value="View Details" ng-click="GetpaymentDetails(x)" />
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

单击按钮时,我需要使用ID作为参数。 UnsuccessLoan.html中的数据应基于该ID生成。这是我在UnsuccessLoan.html中使用的angularJS代码。那么如何将loan.html id传递给另一页。

$scope.GetpaymentDetails = function (loan) {
    var post = $http({
        method: "POST",
        url: WebApiBaseUri + "LoanDetails/GetRepayDetails",
        dataType: 'json',
        data: JSON.stringify(loan),
        headers: { "Content-Type": "application/json" }
    });
    post.success(function (data, status) {
        $scope.rejectedLoanList = data;
    });
    post.error(function (data, status) {

    });
};

0 个答案:

没有答案