diff --git a/src/pagination/docs/readme.md b/src/pagination/docs/readme.md index d0ebd9a87b..bdab246c67 100644 --- a/src/pagination/docs/readme.md +++ b/src/pagination/docs/readme.md @@ -85,3 +85,7 @@ For `ng-model`, `total-items`, `items-per-page` and `num-pages` see pagination s * `template-url` _(Default: 'template/pagination/pager.html') : Override the template for the component with a custom provided template + + * `ng-disabled` + : + Used to disable the pager component diff --git a/src/pagination/pagination.js b/src/pagination/pagination.js index 8b31ee46ec..e7fcfae273 100644 --- a/src/pagination/pagination.js +++ b/src/pagination/pagination.js @@ -207,7 +207,8 @@ angular.module('ui.bootstrap.pagination', []) scope: { totalItems: '=', previousText: '@', - nextText: '@' + nextText: '@', + ngDisabled: '=' }, require: ['pager', '?ngModel'], controller: 'PaginationController', diff --git a/src/pagination/test/pager.spec.js b/src/pagination/test/pager.spec.js index ce6496be90..7527e83a76 100644 --- a/src/pagination/test/pager.spec.js +++ b/src/pagination/test/pager.spec.js @@ -256,4 +256,26 @@ describe('pager directive', function() { }); }); + it('disables the component when ng-disabled is true', function() { + $rootScope.disable = true; + + element = $compile('')($rootScope); + $rootScope.$digest(); + updateCurrentPage(2); + + expect(getPaginationEl(0)).toHaveClass('disabled'); + expect(getPaginationEl(-1)).toHaveClass('disabled'); + + $rootScope.disable = false; + $rootScope.$digest(); + + expect(getPaginationEl(0)).not.toHaveClass('disabled'); + expect(getPaginationEl(-1)).not.toHaveClass('disabled'); + + $rootScope.disable = true; + $rootScope.$digest(); + + expect(getPaginationEl(0)).toHaveClass('disabled'); + expect(getPaginationEl(-1)).toHaveClass('disabled'); + }); }); diff --git a/template/pagination/pager.html b/template/pagination/pager.html index ee7eff53ba..46f227faac 100644 --- a/template/pagination/pager.html +++ b/template/pagination/pager.html @@ -1,4 +1,4 @@ \ No newline at end of file +
  • {{::getText('previous')}}
  • +
  • {{::getText('next')}}
  • +