app_bhi.controller("twController", ["$scope", "$http", "$sce","$location", function ($scope, $http, $sce,$location){ $scope.twlist=[]; $scope.total=0; $scope.pagesize=9; var navid = $('#div_nav').text(); if(navid==null || navid=="") { navid = $("#tw_table_div").text(); $scope.pagesize=6; } $scope.nav_id = navid; if($location.absUrl().indexOf('/pic/tw.html')!=-1) $scope.pagesize=10; if($location.absUrl().indexOf('/bigpic/tw.html')!=-1) $scope.pagesize=4; $scope.pagechange = function(page){ if($scope.total>0 && (page-1)*$scope.pagesize>$scope.total){ return; } if (page==null){ page=1; } $http.jsonp(App.config.api+"/get_tuwen_list?callback=JSON_CALLBACK&nav_id="+navid+"&p="+page+"&size="+$scope.pagesize).success(function(rep){ if(rep.code==1){ $scope.total= rep.total; $scope.twlist= rep.data; } }); }; $scope.pagechange(1); //$scope.total=1; }]);