Rob
Rob

Reputation: 11388

Angular ng-table with Goto page

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?

Upvotes: 11

Views: 1487

Answers (1)

Rob
Rob

Reputation: 11388

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

<input ng-model="params.page" ng-model-options="{getterSetter: true}" />

Upvotes: 4

Related Questions