This is a very handy use case for services. In chapter 6, Component Composition with TypeScript, we discussed how components interact with each other and showed different ways of doing it. One of those ways was left out--using a service as an event hub/communication platform for different components.
Let's assume again that, when an item in the list is clicked, we use a sibling component to the comment list component to show a detailed view of the selected comment. First, we need to create this component:
ng g component comment-detail
Then, you can update the app.component.html file to show the added component:
<div class="container"> <h2 class="text-center">TS Comments</h2> <div class="col-md-4 col-md-offset-2"> ...