Using angular 7(Angular flux is not used.), requirement is, we need to show the path of current screen. Like, lets say there are a,b,c,d screens.
We can navigate from a->b->c->d. This path of "a->b->c->d" need to be shown. Also, we can go back by clicking on back button so, if click on back when on d then we are at a->b->c.
Structure is like, there is a component X which is parent inside <router-outlet>
is written where components a,b,c,d will attached based on navigation. Back button and header is available in component X, and header where this path location need to be shown.
Each component a,b,c,d require states, (angular 7 states).
For implementing back button routing event is subscribe, which push current route and state into stack and when clicking on back, pop the last route and navigate to that with angular states required for that page.
Also, there are tabs in screen present like this click for picture When click on tab1 components are a->b->c->d when click on tab2 no matters on which screen, e->f components are there. so navigation path now should change accordingly. same for tab3. These a,b,c,d also clickable, such that when click on b, we will navigate to a->b(now a->b should be shown).
How, this can be implemented in angular 7? Any help is appreciated.
You can do that with
events
ofRouter module
, then create a component namedbreadcrumb
to show navigationFinal result will be as below :
breadcrumb.component.ts:
breadcrumb.component.html:
wherever you define a route , set a data named
breadcrumb
and assign the specific name as below :with module :
with component :
Usage :
in your layout or master page put the following
app-breadcrumb