Guest User

Untitled

a guest
Nov 18th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. this.router.events.filter(event => event instanceof NavigationEnd).subscribe((event) => {
  2. this.breadcrumbs = [];
  3. let currentRoute = this.route.root,
  4. url = '';
  5. do {
  6. const childrenRoutes = currentRoute.children;
  7. currentRoute = null;
  8. childrenRoutes.forEach(route => {
  9. if (route.outlet === 'primary') {
  10. const routeSnapshot = route.snapshot;
  11. url += '/' + routeSnapshot.url.map(segment => segment.path).join('/');
  12. this.breadcrumbs.push({
  13. label: route.snapshot.data,
  14. url: url
  15. });
  16. currentRoute = route;
  17. }
  18. });
  19. } while (currentRoute);
  20. });
  21.  
  22. currentRoute = null;
Add Comment
Please, Sign In to add comment