gmostert / ng2-breadcrumb

This is an angular 2 component that creates a breadcrumb trail. It hooks into the angular2/router, to dynamically build up the crumb trail once a component is routed to.
MIT License
102 stars 81 forks source link

Callback being endlessly called #71

Open mslicee opened 7 years ago

mslicee commented 7 years ago

Hi, I have a route which gets an object based on a C# Guid. I am trying to implement the breadcrumb service to show the object's name as part of the breadcrumbs. However, for some reason, the getEventName Method is being called endlessly. Do you have any ideas on what I might be missing?

constructor(private breadcrumbService: BreadcrumbService, private route: ActivatedRoute, private router: Router, private eventService: EventService) { breadcrumbService.addFriendlyNameForRoute('/event', 'Event List'); breadcrumbService.addFriendlyNameForRoute('/event/create', 'Create'); breadcrumbService.addFriendlyNameForRoute('/event/update', 'Update'); breadcrumbService.addCallbackForRouteRegex('\/event\/update\/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}', this.getEventName); }

getEventName(id:string):string { debugger; return 'specific name for user with id'; }

Example URL: http://localhost:4200/event/update/d7b01d81-7b4c-4e20-9562-7e14019a1fd8

garrylachman commented 6 years ago

saw this issue too.. this is worked for me change this.getBreadCrumbsName to (id) => this.getBreadCrumbsName(id)