I have a details page with comments. For single comment, I've created a @Component. Trick is, every comment can have child-comments.
Here's how my details.html looks like:
some info here...
<single-comment ngFor... [comment]="'hi comment'"></single-comment>
And the single-comment.html looks like:
<ion-item no-padding>
<small dark>
<strong>{{comment}}</strong>
</small>
<ng-content></ng-content>
<single-comment [comment]="'ANOTHER comment'"></single-comment>
</ion-item>
The component itself:
@Component({
selector: 'single-comment',
templateUrl: 'single-comment.html'
})
export class SingleComment {
@Input() comment: string;
constructor() {
}
ngAfterContentInit() {
console.log('new comment', this.comment);
}
}
The thing is, 2nd aka. child-component never gets called.
I've also created a Plunkr code which better shows the example. Plunkr is visible here: https://plnkr.co/edit/w5kWE6QdbEoXIpqLI4dc?p=preview. The "details" page in plunkr example is home.html, which also holds the @Component itself.
Is this an Angular2 bug or is that kind of behavior not possible at all? My solution would be to show a nested comments, but since I'm unable to get 2nd comment to load, I'm kind of in an dead-end.
Is there a solution to this or just a better way to achieve what I'm trying to do?
Thank you all for helping.