Pagination Angular Directive

I am trying to write a directive to create links to pages using the concept used in simplePagination, the previous and next links are the only links created and when I click on them an error is generated:

Uncaught SyntaxError: Unexpected token : 

here is the fiddle http://jsfiddle.net/kelvo/zZURe/

Change 1

got the rest of the links to show, but the bi-directional binding '=' does not work.

here is the new fiddle http://jsfiddle.net/kelvo/zZURe/7/

+7
source share
1 answer

You were updating a piece of code outside of angular and you had to know angular for the processing itself.

  $scope.selectPage = function(pageIndex) { $scope.currentPage = pageIndex; $scope.draw(); $scope.$apply(); } 

I added $ scope. $ apply (); and now currentPage is updated correctly on input. Here are the documents on the $ apply method: http://docs.angularjs.org/api/ng.$rootScope.Scope#$apply

jsfiddle : http://jsfiddle.net/zZURe/14/

+6
source

All Articles