I have been trying to make an http call for a while but I am stuck here as I am not able to resolve the actual data value from the returned $$state variable. This is my code:
function (action, req){
var myData = $http.post('../rest/'+action, req)
.then(function(response) {
var data= response.data;
console.log("data: "+data); //1st console
return data;
},
function(response) {
alert(JSON.stringify(response));
});
console.log(myData); //2nd console
}
In the first console the values comes out to be fine as: data: This is my data.
However when I return the same value and print it in the second console it is wrapped up in a $$state object. This is my second console: d { $$state={...}, then=function(), catch=function(), more...}
When i expand it i get this value(in window>d):
Please help. What i need to do next to get $$state.value or d.$$state.value?