I have fetched data from backend API, need to loop the data in front end but its value not return.
here is my response from backend API.
[
[
{
"choice": 1,
"count": 4,
"percentageValue": "80.0000"
},
{
"choice": 2,
"count": 1,
"percentageValue": "20.0000"
}
],
[
{
"choice": 1,
"count": 4,
"percentageValue": "80.0000"
},
{
"choice": 2,
"count": 1,
"percentageValue": "20.0000"
}
]
]
In ts file
submitPoll(data){
this.pollService.submitPoll(data).subscribe(response =>{
this.percentage=response.body;
});
}
In html file
<p *ngFor="let percentage of percentage;let i= index;">
{{percentage.choice }}
</p>
how to use the for loop for array object ? i need to display the percentage in options

*ngFors in the template.