Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.router.events.filter(event => event instanceof NavigationEnd).subscribe((event) => {
- this.breadcrumbs = [];
- let currentRoute = this.route.root,
- url = '';
- do {
- const childrenRoutes = currentRoute.children;
- currentRoute = null;
- childrenRoutes.forEach(route => {
- if (route.outlet === 'primary') {
- const routeSnapshot = route.snapshot;
- url += '/' + routeSnapshot.url.map(segment => segment.path).join('/');
- this.breadcrumbs.push({
- label: route.snapshot.data,
- url: url
- });
- currentRoute = route;
- }
- });
- } while (currentRoute);
- });
- currentRoute = null;
Add Comment
Please, Sign In to add comment