-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breadcrumbs initial state is empty when chained in multiple router outlets #109
Comments
Hello 👋 @Vankerkom |
@Vankerkom can you please provide a reproducible example. Please use https://stackblitz.com/edit/angular-xng-breadcrumbs as reference |
For anyone who comes across this issue with a similar problem: I spend some time trying to create a reproducible example, because this happened on a project of mine too and it was super annoying. Here it is: https://stackblitz.com/edit/angular-xng-breadcrumbs-ch2s2r?file=src%2Fapp%2Fapp.component.ts What (apparently) was my problem:
The element is included in the "main" component, NOT in the "app" component. When you open (or refresh) the page there is no breadcrumb shown. It only shows up once you click on "Feature2" and then it will stay even if you go back to Feature1. It's only missing on initial page load. What solved it for me (and does as well in this example) is to require an instance of BreadcrumbService in AppComponent. TL;DR: |
Thank you @TobiasXy for the analysis and also for providing a fix from the application side. If you know how to fix this in the library without having to inject in App component, please provide a fix as PR. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
not stale |
I'm having the same issue. Using version 6.8.3 on Angular 10. Apart from the work around fix mentioned has there been any other fix? |
@TobiasXy could you share a code example of the fix you mentioned. Because I injected the breadcrumbService into my app.component.ts but I'm still getting the same issue. When I initially load my application I do not see the breadcrumb but if I click on another page and comeback to the homepage then I can see the breadcrumbs |
@udayvunnam Have there been any fixes for this issue? |
In february I wasn't able to set up the test suite, so unfortunately I couldn't provide a fix. A code example (that also works in the stackblitz linked above) would be this code in your app.component.ts (or whatever your outermost component is called) // ...
import { BreadcrumbService } from 'xng-breadcrumb';
// ...
export class AppComponent {
// ...
constructor(breadcrumbService: BreadcrumbService /*, other parameters */) {
//...
}
// ....
} |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
🐞 Bug report
Description
The breadcrumbs do not initialize correctly when chained into multiple router outlets. The breadcrumbs show up after navigating to another page.
🔬 Minimal Reproduction
Create an application with the following structure:
💻Your Environment
xng-breadcrumb@6.8.2
Angular Version: 12.1
🔥 Exception or Error
None.
The text was updated successfully, but these errors were encountered: