Nicoleta Wilskon Nicoleta Wilskon - 1 month ago 9x
AngularJS Question

Handling key value pair in response

I have the following response.

response: {
"json": {
"Total Contacts: 1 Users: 36",


I need to Assign
$scope.state = India

How to fetch that ? I have tried giving
$scope.state =[0].data[1][0].x
, which returns undefined data.

The thing is it has key and entry. I really lacking to fetch entry values from the code.

I gave code this way

$.each(data, function(key, entry) { x.push(parseInt(entry.x)});

but it gives me values [india] in my console.


Try giving $scope.state =[0].data[1][0].x ;

Your statement doesn't start from the root response object.