I feel the architecture you guys are following would not scale well.
Here's what I suggest:
So you are having two components:
PostComponent: This component will render a post.
CommentsComponent: This component will be used inside the PostComponent's Template.
Now suppose this is how your post component template looks like:
<!--Some data to be displayed about the post-->
<comments postId="post.id"></comments>
Now in the comments.component.ts
file, here's what you'll have:
import { Component, Input, OnInit } from '@angular/core';
import { CommentsService } from 'path-to-comments-service';
import { Comment } from 'path-to-comment-model';
@Component({
selector: 'app-comments',
templateUrl: './comments.component.html',
styleUrls: ['./comments.component.css']
})
export class AppComponent implements OnInit {
@Input() postId;
comments: Comment[];
constructor(private commentsService: CommentsService) {}
ngOnInit() {
this.commentsService.getCommentsForPost(postId).subscribe(comments => this.comments = comments);
}
}
After this, you can use these comments in your comments.component.html
NOTE: This is just my suggestion based on the info. you've provided in your question.