angular ng-click ternary conditional

I'm making a pagination system with the "next" button. The "next" button should increase the page.currentPage variable, but it should not do anything when it reached the maximum numPagesTotal.

How do I add this condition to the following ng-click expression:

<a ng-click="page.currentPage = page.currentPage + 1">Next</a>

I figured that I need another block variable that is set to true when page.currentPage === numPagesTotal, and do something like below:

<a ng-click="block || page.currentPage = page.currentPage + 1">Next</a>

How do I set block in the ng-click?

jsFiddle, for reference

You are approaching the problem correctly. You don't even need the extra block variable. Just do this:

<a ng-click="page.currentPage === numPagesTotal || (page.currentPage = page.currentPage + 1)">next</a>

But I would recommend, for clarity of the View, to make this determination in the controller:

$scope.next = function(){
   if ($scope.page.currentPage < $scope.numPagesTotal){
      $scope.page.currentPage++;
   }
}

and just call that function:

<a ng-click="next()">next</a>

I think this does what you want.

<a ng-click="page.currentPage >= numPagin || (page.currentPage=page.currentPage+1)">next</a>

This may help you

{{(curPage*pageSize)+1}}-{{records=pageSize>count?count:(curPage == pagesCount-1) ? count:(curPage + 1)*pageSize}} of {{ count }}