简体   繁体   English

为angularjs分页设置plnkr不起作用

[英]setting up plnkr for angularjs pagination not working

I am new to using plnkr. 我是使用plnkr的新手。 I have created my first plnkr and facing an issue in setting the $scope.currentPage variable. 我已经创建了我的第一个plnkr,并且在设置$scope.currentPage变量时遇到问题。 All other variables are working fine except the currentPage. 除了currentPage之外,所有其他变量都可以正常工作。 I am using the angular-utils-pagination directive. 我正在使用angular-utils-pagination指令。 Once I click on the page number the variable is getting printed but when the page gets loaded for the first time the variable is not initialized. 单击页码后,变量将被打印,但是第一次加载页面时,变量未初始化。 Please let me know where I am going wrong. 请让我知道我要去哪里了。 The link for the plnkr - Link plnkr的链接- 链接

The problem is that you are injecting $scope into your MyApp directive. 问题是您要将$ scope注入MyApp指令。 There's no need to do this since directives have access to their parent scope by default. 由于指令默认情况下可以访问其父作用域,因此不需要这样做。 So it should look like this: 所以它应该看起来像这样:

angular.module('myApp').directive('myTable', function () 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM