I am new to Angular and trying to get the values inside postdata, but when i am trying to iterate over it , its only giving me the first value. Attaching my code:
posts;
constructor(private getpostservice:GetpostsService) { }
ngOnInit(): void {
this.getpostservice.getposts().then(data=>{
this.posts = [data];
console.log("Inside home",this.posts);
})
}
This is my html logic:
<tr *ngFor="let p of posts;index as i">
<td>
{{p.postdata[i].title}}
</td>
</tr>
Can someone help me to extract title and body please?

this.posts = [data];? If your request response data is an array, you would have an array of arrays - bad idea. And if its just an object, then you would not need a loop to iterate over it.