Home > Software design >  How to display specific comments for specific post in Angular 13?
How to display specific comments for specific post in Angular 13?

Time:05-24

I´m trying to display a list of posts with a comment section that is unique to that post. Instead of displaying specific comments under specific posts, all the comments are displayed on every single post.

I have got 2 models:

User Model

Answer from back of get list of posts:

Post Model

My backnode get all posts:

My service in Angular:

get all posts service

My component:

Component in Angular

And here the HTML. I have tried with *ngFor, and ng-repeat and different ways. I am sort of new in Angular, any help will be appreciated.

HTML

Answer from back from get all posts:

Postman answer

VSC answer

CodePudding user response:

you have to make the comments array of the post inside its post object

  • Related