0

I am trying to display one item from a nested array:

{
"results":[
{
    "info": {
        "first_name": "JOHN",
        "last_name": "DOE"
    }
}
]}

I have tried multiple things but cannot get it to work to only display "first_name".

What I've tried is:

<div ng-repeat="s in display.results">
        <p>
            {{s.info}}
        </p>
</div>

But that just goes horribly wrong.

Any help would be appreciated.

2
  • 1
    s.info.first_name? Commented Dec 4, 2019 at 20:47
  • Yep that was it. Feel pretty dumb right now how I have been overlooking that. Commented Dec 4, 2019 at 21:18

1 Answer 1

1

You forgot to access the 'first_name' property

<div ng-repeat="s in display.results">
  <p>
    {{s.info.first_name}}
  </p>
</div>
Sign up to request clarification or add additional context in comments.

2 Comments

I realized that. Had been looking everywhere but overlooked one element. Thanks!
Thanks for the answer, but typically this sort of question should just be closed as "typo/no longer reproducible/resolved in a way that won't help future visitors".

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.