AngularJS 1.2.0 を使用しています。$resouce を使用して Web サービスを呼び出すと、応答変数は常に空になります。Web サービスは正しく呼び出され、Web サービスは結果をブラウザーに送信しています。問題は、(callback(response){}) 応答が常に空であることです。
angular.module('app').factory('geoCoding',['$resource', function ($resource) {
return $resource('http://open.mapquestapi.com/geocoding/v1/address', {key: getGeoKey()}, {
locate: {method: 'GET', isArray: false}
});
}]);
$scope.getLocations = function (locationName) {
return geoCoding.locate({location: locationName}).$promise.then(
function (response) {
log.log('response ', response);
if (response && response.data && response.data.results && response.data.results[0]) {
var locations = [];
response.data.results[0].locations.forEach(function (location) {
locations.push({name: geoUtils.location2String(location), location: location});
});
return locations;
} else {
return {};
}
}, function (error) {
log.error('Locations Query error: ', error);
});
};