1

If I have the following API response, how to fetch the value player using ngFor in angular 7?

enter image description here

7
  • post what you have done so far Commented Apr 23, 2019 at 7:31
  • <div class="col" *ngFor="let parent of summeryDetail.match_details"> <div class="text-center pt-3" *ngFor="let child1 of parent.team_a"> <h3 class="mb-0" *ngFor="let child2 of child1.teama_player">{{ child2.player }}</h3> </div> Commented Apr 23, 2019 at 9:18
  • @KrishnamoorthyM match_details is an object so this will not work! Commented Apr 23, 2019 at 9:42
  • @Prashant Pimpale , Okay what's the changes needs to be done... how to handle this nested object. Commented Apr 23, 2019 at 9:47
  • @KrishnamoorthyM Please provide the Sample JSON in the form of code. so will try Commented Apr 23, 2019 at 9:59

1 Answer 1

1

If you want to get the list of all players i.e teama_player list so you can just:

<div class="col" *ngFor="let obj of summeryDetail.match_details.team_a.teama_player">
   {{obj.player}}
</div>
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.