Angularjs分页错误

时间:2014-05-07 00:20:59

标签: angularjs pagination angular-ui-bootstrap

我正在尝试从此处集成Angular UI分页指令 - > http://angular-ui.github.io/bootstrap/#/pagination

问题是,当我点击任何分页按钮时,我收到以下错误。

Error: [$compile:nonassign] Expression 'undefined' used with directive 'pagination' is non-assignable!
http://errors.angularjs.org/1.3.0-beta.7/$compile/nonassign?p0=undefined&p1=pagination
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.js:78:12
    at parentSet (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.js:6618:25)
    at Object.parentValueWatch (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.js:6632:23)
    at Scope.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.js:12550:40)
    at Scope.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.js:12823:24)
    at HTMLAnchorElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.js:19757:21)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.js:2883:10
    at forEach (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.js:327:20)
    at HTMLAnchorElement.eventHandler (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.js:2882:5) angular.js:10028
(anonymous function) angular.js:10028
(anonymous function) angular.js:7349
Scope.$digest angular.js:12577
Scope.$apply angular.js:12823
(anonymous function) angular.js:19757
(anonymous function) angular.js:2883
forEach angular.js:327
eventHandler

这是分页元素的代码:

<pagination total-items="totalItems" max-size="5" ng-model="currentPage" items-per-page="itemsPerPage" ng-change="PageChanged()"></pagination>

这似乎是指令本身的一个错误,但我不确定。

2 个答案:

答案 0 :(得分:5)

您似乎需要升级到ui-bootstrap-tpls-0.11.0.js,或使用旧语法:

page="currentPage"

另见 Pagination in Angular UI Bootstrap throwing "Error: [$compile:nonassign]"

答案 1 :(得分:1)

您正在使用Angular 1.3.0-beta.7 - 在1.3正式发布并更新第三方指令之前,我不希望第三方指令有效。

下载到最新的官方稳定版