Question: In the web application I'm building, when any link is clicked and route is changed, I need to know which component the clicked link belongs to. 

like if any link in the header component was clicked 'about us' for example  

I need to console log 'header-component' for example,  

but if I clicked 'about us' from the footer component, I will get 'footer-component' and so...

This functionality should be added for all the `<a>` elements that can change the route.

Answer: 
You should just be able to use `ngOnInit` here to initialise `comments$`.

When it is called, any `@Input` bindings will be completed so the value for `this.post` will be set.

```
ngOnInit() { 
 this.comments$ = this.store.select(CommentState.postComments)
   .pipe(
      map(fn => fn(this.post.id))
    );
}

```

Lifecycle details here [OnInit](https://angular.io/guide/lifecycle-hooks#oninit)
I found the bug, so I'm sharing here in case anyone's interested.  

I was wrong to assume that calling `store.select` after the construction doesn't work (it just hit me that there's no reason for it to be any different than calling it during `ngOnChanges`). 

It turns out that the selection was working just fine, but the reason I didn't get any results was that I didn't dispatch a `FetchComments` action before the selection. 
That means that I always got 0 commens back ... 

I just want to clarify that in such a case, the correct place to do the selection, is either in the setter of the `@Input` or during `ngOnChanges` where you can verify that the value of the input is valid.  

If you try to place the selection in `ngOnInit`, the `@Input` might not have been initialized yet in case of an asynchronoud initialization.