1- angular . module ( 'ui.bootstrap.paging' , [ ] )
2- /**
3- * Helper internal service for generating common controller code between the
4- * pager and pagination components
5- */
6- . factory ( 'uibPaging' , [ '$parse' , function ( $parse ) {
1+ angular
2+ . module ( 'paging' , [ ] )
3+ . factory ( 'paging' , [ '$parse' , function ( $parse ) {
74 return {
85 create : function ( ctrl , $scope , $attrs ) {
96 ctrl . setNumPages = $attrs . numPages ? $parse ( $attrs . numPages ) . assign : angular . noop ;
@@ -84,18 +81,19 @@ angular.module('ui.bootstrap.paging', [])
8481 } ;
8582 } ] ) ;
8683
87- angular . module ( 'ui.bootstrap.pagination' , [ 'ui.bootstrap.paging' ] )
88- . controller ( 'UibPaginationController' , [ '$scope' , '$attrs' , '$parse' , 'uibPaging' , 'uibPaginationConfig' , function ( $scope , $attrs , $parse , uibPaging , uibPaginationConfig ) {
84+ angular
85+ . module ( 'pagination' , [ 'paging' ] )
86+ . controller ( 'PaginationController' , [ '$scope' , '$attrs' , '$parse' , 'paging' , 'paginationConfig' , function ( $scope , $attrs , $parse , paging , paginationConfig ) {
8987 var ctrl = this ;
9088 // Setup configuration parameters
91- var maxSize = angular . isDefined ( $attrs . maxSize ) ? $scope . $parent . $eval ( $attrs . maxSize ) : uibPaginationConfig . maxSize ,
92- rotate = angular . isDefined ( $attrs . rotate ) ? $scope . $parent . $eval ( $attrs . rotate ) : uibPaginationConfig . rotate ,
93- forceEllipses = angular . isDefined ( $attrs . forceEllipses ) ? $scope . $parent . $eval ( $attrs . forceEllipses ) : uibPaginationConfig . forceEllipses ,
94- boundaryLinkNumbers = angular . isDefined ( $attrs . boundaryLinkNumbers ) ? $scope . $parent . $eval ( $attrs . boundaryLinkNumbers ) : uibPaginationConfig . boundaryLinkNumbers ;
95- $scope . boundaryLinks = angular . isDefined ( $attrs . boundaryLinks ) ? $scope . $parent . $eval ( $attrs . boundaryLinks ) : uibPaginationConfig . boundaryLinks ;
96- $scope . directionLinks = angular . isDefined ( $attrs . directionLinks ) ? $scope . $parent . $eval ( $attrs . directionLinks ) : uibPaginationConfig . directionLinks ;
89+ var maxSize = angular . isDefined ( $attrs . maxSize ) ? $scope . $parent . $eval ( $attrs . maxSize ) : paginationConfig . maxSize ,
90+ rotate = angular . isDefined ( $attrs . rotate ) ? $scope . $parent . $eval ( $attrs . rotate ) : paginationConfig . rotate ,
91+ forceEllipses = angular . isDefined ( $attrs . forceEllipses ) ? $scope . $parent . $eval ( $attrs . forceEllipses ) : paginationConfig . forceEllipses ,
92+ boundaryLinkNumbers = angular . isDefined ( $attrs . boundaryLinkNumbers ) ? $scope . $parent . $eval ( $attrs . boundaryLinkNumbers ) : paginationConfig . boundaryLinkNumbers ;
93+ $scope . boundaryLinks = angular . isDefined ( $attrs . boundaryLinks ) ? $scope . $parent . $eval ( $attrs . boundaryLinks ) : paginationConfig . boundaryLinks ;
94+ $scope . directionLinks = angular . isDefined ( $attrs . directionLinks ) ? $scope . $parent . $eval ( $attrs . directionLinks ) : paginationConfig . directionLinks ;
9795
98- uibPaging . create ( this , $scope , $attrs ) ;
96+ paging . create ( this , $scope , $attrs ) ;
9997
10098 if ( $attrs . maxSize ) {
10199 $scope . $parent . $watch ( $parse ( $attrs . maxSize ) , function ( value ) {
@@ -193,7 +191,7 @@ angular.module('ui.bootstrap.pagination', ['ui.bootstrap.paging'])
193191 } ;
194192 } ] )
195193
196- . constant ( 'uibPaginationConfig ' , {
194+ . constant ( 'paginationConfig ' , {
197195 itemsPerPage : 10 ,
198196 boundaryLinks : false ,
199197 boundaryLinkNumbers : false ,
@@ -206,7 +204,7 @@ angular.module('ui.bootstrap.pagination', ['ui.bootstrap.paging'])
206204 forceEllipses : false
207205 } )
208206
209- . directive ( 'uibPagination ' , [ '$parse' , 'uibPaginationConfig ' , function ( $parse , uibPaginationConfig ) {
207+ . directive ( 'pagination ' , [ '$parse' , 'paginationConfig ' , function ( $parse , paginationConfig ) {
210208 return {
211209 scope : {
212210 totalItems : '=' ,
@@ -216,8 +214,8 @@ angular.module('ui.bootstrap.pagination', ['ui.bootstrap.paging'])
216214 lastText : '@' ,
217215 ngDisabled : '='
218216 } ,
219- require : [ 'uibPagination ' , '?ngModel' ] ,
220- controller : 'UibPaginationController ' ,
217+ require : [ 'pagination ' , '?ngModel' ] ,
218+ controller : 'PaginationController ' ,
221219 controllerAs : 'pagination' ,
222220 templateUrl : function ( element , attrs ) {
223221 return attrs . templateUrl || 'src/template/pagination/pagination.html' ;
@@ -230,15 +228,13 @@ angular.module('ui.bootstrap.pagination', ['ui.bootstrap.paging'])
230228 return ; // do nothing if no ng-model
231229 }
232230
233- paginationCtrl . init ( ngModelCtrl , uibPaginationConfig ) ;
231+ paginationCtrl . init ( ngModelCtrl , paginationConfig ) ;
234232 }
235233 } ;
236234 } ] )
237235
238236 . run ( [ '$templateCache' , function ( $templateCache ) {
239-
240237 $templateCache . put ( 'src/template/pagination/pagination.html' ,
241238 "<ul class='pagination'><li ng-if='::boundaryLinks' ng-class='{disabled: noPrevious()||ngDisabled}' class='pagination-first'><a href ng-click='selectPage(1, $event)'>{{::getText('first')}}</a></li> <li ng-if='::directionLinks' ng-class='{disabled: noPrevious()||ngDisabled}' class='pagination-prev'><a href ng-click='selectPage(page - 1, $event)'>{{::getText('previous')}}</a></li> <li ng-repeat='page in pages track by $index' ng-class='{active: page.active,disabled: ngDisabled&&!page.active}' class='pagination-page'><a href ng-click='selectPage(page.number, $event)'>{{page.text}}</a></li> <li ng-if='::directionLinks' ng-class='{disabled: noNext()||ngDisabled}' class='pagination-next'><a href ng-click='selectPage(page + 1, $event)'>{{::getText('next')}}</a></li> <li ng-if='::boundaryLinks' ng-class='{disabled: noNext()||ngDisabled}' class='pagination-last'><a href ng-click='selectPage(totalPages, $event)'>{{::getText('last')}}</a></li> </ul>"
242239 ) ;
243-
244240 } ] ) ;
0 commit comments