Angular ng-table with Goto page
Asked Answered
M

1

11

I'm using ng-table to setup a custom pagination control. I want to have an input that only allows valid page numbers. I have the existing pagination so far.

script(type="text/ng-template" id="ng-table-pagination-input")
  div(class="ng-cloak ng-table-pager" ng-if="params.data.length")
    br
    ul(ng-if="pages.length" class="pagination ng-table-pagination")
      li(ng-class="{'disabled': !page.active && !page.current, 'active': page.current}" ng-repeat="page in pages" ng-switch="page.type")
        a(ng-switch-when="prev" ng-click="params.page(page.number)" href="")
          span «
        a(ng-switch-when="next" ng-click="params.page(page.number)" href="")
          span »

How can I get an input control in there to work properly?

Mcclung answered 29/1, 2016 at 9:21 Comment(4)
Can you create any working code snippet?Magnanimous
Pretty much any example here ng-table.com. Except need to put an input to allow the pagination to change.Mcclung
you want textbox for enter page number manually right?Magnanimous
yes, but it should update the pagination (and page).Mcclung
M
4

Ended up finding the magical piece of Angular code to make this work.

<input ng-model="params.page" ng-model-options="{getterSetter: true}" />
Mcclung answered 1/2, 2016 at 6:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.