Open feelthesource opened 6 years ago
I'm having this issue with Ng5-Breadcrumb as well. I wonder when this fix will go out? +1
Same problem for me with Ng5-Breadcrumb.
Hello guys, I had the same issue but i have fixed.
The problem was in the ngOnInit
function of breadcrum.component.ts
execute this.router.events
.
When a user refresh the page, there isn't a event, so the subcription of the router.events doesn't work and generateBreadcrumbTrail( )
isn't called.
My solution is that:
if (this.router.navigated) {
this._urls.length = 0; //Fastest way to clear out array
this.generateBreadcrumbTrail(this.router.routerState.snapshot.url);
this._routerSubscription = this.router.events.subscribe( ... )
}
On this way, generateBreadcrumbTrail( )
will be called when refreshing is happend.
Still have problem with ng-5 breadcrumbs, how to resolve that. I have seen there is PR waiting. https://github.com/gmostert/ng2-breadcrumb/pull/101
I am using ng6-breadcrumbs and am having the same problem. is there a fix??
Hello guys, I had the same issue but i have fixed. The problem was in the
ngOnInit
function ofbreadcrum.component.ts
executethis.router.events
. When a user refresh the page, there isn't a event, so the subcription of the router.events doesn't work andgenerateBreadcrumbTrail( )
isn't called. My solution is that:if (this.router.navigated) { this._urls.length = 0; //Fastest way to clear out array this.generateBreadcrumbTrail(this.router.routerState.snapshot.url); this._routerSubscription = this.router.events.subscribe( ... ) }
On this way,
generateBreadcrumbTrail( )
will be called when refreshing is happend.
Would this fix work for ng6-breadcrumbs too?
When refreshing (browser refresh - F5) a page that contains a
breadcrumb
trail, the trail is lost. If the breadcrumb trail includes a prefix, only the prefix is shown after the refresh.I think this issue is caused by the breadcrumb component's
ngOnInit
method only setting up the prefix, instead of calling thegenerateBreadcrumbTrail
method.