I have a project using angular 2 where the title component, the navigation bar component and the body component where all the other components are loaded. As the picture below
- Headline
- Navigation
- Where other components are downloaded (this section may have nested / child components)

So basically, in the header component, I want to show the current state . And at the bottom of the current state, I want to show the previous state of the user.
Questions: To implement this, I used the component interaction technique in angular.
after restarting the application, the default value for the current and
reverse conditions.
In a scenario, for example, when a user lands directly on a specific page, which is a child component in the body, the default value for the current and back states is also displayed.
Since angular follows component architecture, I want to better implement this function.
If I come directly to the child component in section 3 in the figure, my header component should get the title / current state according to the specific page in the header component.
My solution for this was in every component when ngOnInit passed the current state value. I also analyze the previous state value. Therefore, the header component shows this as it is, since the service is written using the technique in this link - https://angular.io/docs/ts/latest/cookbook/component-communication.html
But there are some cases when I get data from the server and need to update the current status of the header. There I see that this is not displayed at all.
Need help with a good solution.
PS - Since this mechanism is in different view files, and it is a bit complicated, I helplessly update the code template
source share