Working with json data retrieved from a web service
myService.getData()
.then(function(data, status, headers, config){
alert(data.length);
}...
While I can successfully retrieve and inspect data through the browser console within the code, in the then
block it appears as undefined.
Any ideas on what might be going wrong here?
Update: Here's how my service call is structured
return $http.post("http:/...", {
headers: {'Authorization': 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' }
}).success(function(data, status, headers, config){
return data;
}).error(function(data, status, headers, config){
alert('err');
});