C
C
Chvalov2019-07-11 13:46:41
Angular
Chvalov, 2019-07-11 13:46:41

How to change the items in the sidebar when changing the page?

How to correctly implement the replacement of menu items in the sidebar when changing the page
5d2710e897ac7135596769.png
So that when a page is selected in the top menu, the items and components in the sidebar change?
Is it possible to do this by checking the current module/route in ngif ?
Or for each page to display its own sidebar ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2019-07-11
@streetflush

If the points are not repeated, you can make your own for each.
If there are repetitions, then immediately push all the items into the sidebar, and then filter them by ngIf.
You can bind to ActivatedRoute

C
Chvalov, 2019-07-11
@Chvalov

Ivan Stroykin suggested another option , for which he is grateful:

The first thing that came to mind was to describe somewhere the navigation arrays in one case or another, which will be used in the menu on the right (via ngFor or at your discretion). And in the component of your menu, subscribe to the change of the route, where you will determine if it has changed - look if you need to change the menu, if so, then just take the desired array and output it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question