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");
});
}
}
}