javascript - Angularjs Pagination directive - Stack Overflow

i am trying to write a directive to generate pagination links using the concept used in a simplePaginat

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 /

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 /

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/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/kelvo/zZURe/7/

Share Improve this question edited Dec 31, 2012 at 10:35 klvmungai asked Dec 31, 2012 at 9:54 klvmungaiklvmungai 8241 gold badge13 silver badges21 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 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/api/ng.$rootScope.Scope#$apply

jsfiddle: http://jsfiddle/zZURe/14/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742410238a4438665.html

相关推荐

  • javascript - Angularjs Pagination directive - Stack Overflow

    i am trying to write a directive to generate pagination links using the concept used in a simplePaginat

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信