【问题标题】:angular UI Bootstrap pagination in asp.net mvc throws error TypeError: v13.itemsPerPage is not a functionasp.net mvc 中的 Angular UI Bootstrap 分页引发错误 TypeError: v13.itemsPerPage is not a function
【发布时间】:2020-07-28 23:57:41
【问题描述】:

我的 ui.bootstrap.pagination 在实现时抛出错误:TypeError: v13.itemsPerPage is not a function。

我是 Angular 和 javascript 的新手,因此非常感谢任何帮助。
使用

asp.net mvc 4.0.30319

角度:1.7.9

angular-ui-bootstrap 2.5.0

查看:

    <div ng-controller="someController">
        <div class="divTable blueTable">
            <div class="divTableHeading">
                <div class="divTableRow">
                    <div class="divTableCell">Date</div>
                    <div class="divTableCell">Amount</div>
                    <div class="divTableCell">Machine</div>
                    <div class="divTableCell">Player ID</div>
                    <div class="divTableCell">First Name</div>
                    <div class="divTableCell">Last Name</div>
                    <div class="divTableCell">Address</div>
                    <div class="divTableCell">City</div>
                    <div class="divTableCell">State</div>
                    <div class="divTableCell">Zip</div>
                </div>
            </div>
            <div class="divTableBody">
                <div class="divTableRow" ng-repeat="jackpot in jackpots | limitTo: itemsPerPage(currentPage -1) * itemsPerPage    ">
                    <div class="divTableCell">{{jackpot.Date | date:'MM/dd/yyyy' }}</div>
                    <div class="divTableCell">{{jackpot.Amount | currency }}</div>
                    <div class="divTableCell">{{jackpot.Machine}}</div>
                    <div class="divTableCell">{{jackpot.PlayerID }}</div>
                    <div class="divTableCell">{{jackpot.FirstName }}</div>
                    <div class="divTableCell">{{jackpot.LastName }}</div>
                    <div class="divTableCell">{{jackpot.Address }}</div>
                    <div class="divTableCell">{{jackpot.City }}</div>
                    <div class="divTableCell">{{jackpot.State }}</div>
                    <div class="divTableCell">{{jackpot.Zip }}</div>
                </div>
            </div>
    </div>
<ul uib-pagination total-items="jackpots.length" ng-model="currentPage" max-size="5"  
    items-per-page="itemsPerPage" boundary-links="true" force-ellipses="true"></ul>

Javascript:

var someApp = angular.module("ModuleX", ['ui.bootstrap']);
someApp.controller("someController", function ($scope, $http) {
    $scope.currentPage = 1;
    $scope.itemsPerPage = 2;
        $http.get('http://localhost/services/webServices.asmx/getJackpots')
        .then(function (response) {
            $scope.jackpots = response.data;
        });
});

非常感谢任何帮助 - 在此先感谢!

【问题讨论】:

    标签: javascript asp.net angularjs model-view-controller


    【解决方案1】:

    看看这一行:

    limitTo: itemsPerPage(currentPage -1) * itemsPerPage  
    

    您将itemsPerPage 变量作为函数调用。您似乎忘记了一些操作数。

    【讨论】:

      猜你喜欢
      • 2021-11-04
      • 1970-01-01
      • 2015-12-01
      • 2015-07-09
      • 1970-01-01
      • 1970-01-01
      • 2022-11-21
      • 2018-05-09
      • 1970-01-01
      相关资源
      最近更新 更多