0
我有点新角,我想从我写的web服务中获取一些数据。我发送一些变量作为帖子。但是我怎样才能得到函数中的http变量。它可能是一个愚蠢的问题,但我找不到解决方案。我需要它在一个函数中,因为我想多次调用它。Angularjs:在函数中获取http变量
kljControllers.controller('CalendarPageController', ['$scope',
function($scope, $http) {
$scope.GetEvents = function() {
var dataToPost = Array();
dataToPost.push($scope.month);
dataToPost.push($scope.year);
$scope.http.post('http://localhost:8080/webservice/calendarevent').
success(function(data, status, headers, config) {
$scope.events = data.events;
}).
error(function(data, status, headers, config) {
document.write("status");
});
}
}
}