I've encountered an interesting problem. My restful backend returns JSON. Accessing the API through the browser yields a validated JSON array with a JSON object.
[{"GUID_Auth":null,"Email_Address":"abc@aol,"Measure_Id":1,"Title":"Prop 41"}]
However, when I use a $http.get request in AngularJS, I receive a string with escaped quotes instead.
got success: "[{\"GUID_Auth\":null,\"Email_Address\":\"abc@aol\",\"Measure_Id\":1,\"Title\":\"Prop 41\"}]"
Below is a snippet of my AngularJS controller code:
.controller('MainCtrl', function($scope,$http) {
$scope.GetData = function(){
var responsePromise = $http.get('http://backend.api');
responsePromise.success(function(data,status,headers,config){
console.log('got success: ' + data);
console.log('test'+ data[0].Email_Address)
});
responsePromise.error(function(data,status,headers,config){
alert('ajax failed');
});
},
This issue is very perplexing. Any assistance would be greatly appreciated.