I'm very new for SPA and i have a question about organizing of cross-zone side-menu, which has different content on each zone. So i want that content of menu changes dynamically every time when user go to new zone.
I can't pass any data to menu's component via @Input()
, because component creates just one time and it does not possible to pass actual data to component every time when need.
I don't want to create unique side-menu for any application zone, because menu has any common elements for all zones.
So my question is how to update data of the common component according to current using component. For illustrate my question:
root component
template: `
<div>
<side-menu></side-menu>
<div>
<router-outlet></router-outlet>
</div>
</div>
`
and structure of my app is
app
|--components
| |--folder1
| |--folder2
| |--shared
| |--side-menu.component.ts
|
|--services
| |--folder1
| |--folder2
..............
In side-menu component i need to render only that element that needs depends on actual state of aaplication. Maybe creating several same menus for each zone is the more prefer way?
I suppose that it is the common problem for SPA, not only for Angular 2, so maybe you provide me conceptual solution for my problem.