当我尝试使用$http.jsonp
获取数据时,数据无法在日志中显示,为什么?
userApp.controller('userCtrl', ['$scope', '$http', 'serverUrl', 'userService', 'loginService', function($scope, $http,serverUrl, userService, loginService) {
$scope.currentPage = 1;
$scope.currentCount = 10;
$scope.perPageOptions = [10, 15, 20, 30, 50];
$scope.pages = [];
$http.jsonp(serverUrl + "/admin/login/?adminName=root&password=123123&callback=JSON_CALLBACK").success(function(data) {
console.log(data); //can't show in the log
});
$http.jsonp(serverUrl + "/admin/users?page=" + $scope.currentPage + "&count=" + $scope.currentCount + "&mobile=&userId=0&status=1&callback=JSON_CALLBACK").success(function(data) {
console.log(data); //can't show in the log
if (data.code == 0) {
$scope.items = data.data.users;
$scope.totalItems = data.data.numTotal;
$scope.totalPage = Math.ceil(data.data.numTotal / $scope.currentCount);
for (var i = 1; i < $scope.totalPage + 1; i++) {
$scope.pages.push(i);
}
}
});
}]);