i searched and researched but i cannot solve my problem.
I'm not so practice with angular, i hope someone can help me!
I created a service for http POST and i must get the result from my controller
CONTROLLER
tantoSvagoApp.controller("ricercaAttivita", function ($scope,
serviceRegioni, serviceRicercaAttivita) {
$scope.regioni = serviceRegioni.get();
var parameters = {
"MasterID": 14,
"NumPart": "",
"Text": "",
"Location": {"Region": "", "Province": ""},
"Attributes": [],
"Price": {"MinPrice": "","MaxPrice": ""},
"ProjectCode": "WS678",
"Pager": {"PageSize": 10,"PageOffset": 1}
};
$scope.elencoAttivita = serviceRicercaAttivita.getAttivita(parameters);
});
SERVICE
tantoSvagoApp.service('serviceRicercaAttivita', function ($http) {
this.getAttivita = function(arr) {
$http({
method: 'POST',
url: 'http://localhost/Tantosvago/api/getAttivita.php',
data: arr
}).then(function successCallback(response) {
var result = response.data;
return result;
}, function (response) {
console.log("Errore " + response.data,response.status);
});
};
}
);
What i get in UNDEFINED.