I am kinda new to angular and I want to get some data from a webservice I wrote. I am sending some variable with it as a post. But how can I get the http variable in the function. It can maybe be a stupid question, but I cannot find the soluction. I need it in a function because I want to call it a couple of times.
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");
});
}
}
}