7

i am trying to write a directive to generate pagination links using the concept used in a simplePagination the prev and next links are the only links being generated and clicking them generates an error:

    Uncaught SyntaxError: Unexpected token : 

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

Edit 1

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

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

1 Answer 1

6

You were updating a piece of code outside of angular and needed to let angular know to reprocess itself.

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

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

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.