3

I have the following bit of code

for (var i = 0; i < $scope.d.results.length; i++) {
    console.log($scope.d.results[i]);  
}

which returns this:

enter image description here

I would like to get the value of the Name field out of this object but I can't think of the syntax to get at it. I've tried a few things with no luck. Can someone explain how to dig down 2 levels and get at it? Thanks!

2
  • 1
    $scope.d.results[i].Name Commented Sep 28, 2015 at 3:33
  • Can you offer that as the answer? I would have sworn up and down that I had tried that and it didn't work. But I just put it back in with success. Thank you Tushar! Commented Sep 28, 2015 at 3:38

1 Answer 1

3

You can use

$scope.d.results[i].Name

As, $scope.d.results[i] returns an object which contains the Name, you can use above syntax to get it from the object.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.