From 0697fa566484a5ecee5d4914e21860d47f4473f4 Mon Sep 17 00:00:00 2001 From: Abel Valero Date: Fri, 11 Sep 2015 16:43:59 +0200 Subject: [PATCH] added top and bottom pagination options --- dist/ng-table.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/dist/ng-table.js b/dist/ng-table.js index af0dc13f..6eb537ac 100644 --- a/dist/ng-table.js +++ b/dist/ng-table.js @@ -1388,11 +1388,28 @@ 'ng-table-pagination': 'params', 'template-url': 'templates.pagination' }); - $element.after(paginationTemplate); if (headerTemplate) { $compile(headerTemplate)($scope); } - $compile(paginationTemplate)($scope); + + // this allows to add the attribute table-pagination-top to ngTable + // so you will see the pagination at the top + if(typeof($attrs.tablePaginationTop) !== 'undefined') { + var topTemplate = paginationTemplate.clone(); + $element.parent().prepend(topTemplate); + $compile(topTemplate)($scope); + } + + // this rewrites the original behaviour, you need to add the attribute table-pagination-bottom + // so you will see the pagination at the bottom as the original + if(typeof($attrs.tablePaginationBottom) !== 'undefined') { + var bottomTemplate = paginationTemplate.clone(); + $element.parent().append(bottomTemplate); + $compile(bottomTemplate)($scope); + } + + // finally you can use the two at the same time + // is a good user experience when the ngTable shows a big number of rows } };