Comments (14)
@roshanjayawardena thanks for the reproducible example. I will rollout a fix likely this week
from xng-breadcrumb.
@roshanjayawardena Thanks for raising this bug. There was a difference in how the breadcrumb is handled for root and is fixed now.
One fix you have to do from the application code is to pass the correct path or Alias to BreadcrumbService.set()
. For home, you can consider path as '' OR '/'
. both works.
The below code should work for you with [email protected]
this.breadcrumbService.set('', {routeInterceptor: (routeLink) => isDesigner ? 'designer' : routeLink})
```;
from xng-breadcrumb.
Hi Uday, @udayvunnam ,
Please refer the below link
https://stackblitz.com/github/roshanjayawardena/mybreadcrumb
Please refer above screenshot. Basically, we navigate a router link based on the user's role. So we want to change home breadcrumb routing dynamically. Please have a look and appreciate if you could suggest a workaround.
Thank you
@roshanjayawardena
from xng-breadcrumb.
Hi uday,
@udayvunnam
Thanks for your time. I updated the latest package and applied the above solution.
But it didn't work as I expected.
I have updated the stackblitz example of how I applied the solution. Please can you guide us?
Further, can you explain the following method?
this.breadcrumbService.set('Home', {
routeInterceptor: (routeLink, breadcrumb) =>
isDesigner ? 'designer' : routeLink,
});
what is the actual parameter we want to pass instead of 'Home'
Should it be actual router value or breadcrumb label value?
Thank you
from xng-breadcrumb.
can't we retrieve the routing values of breadcrumb object?
Can't we update the breadcrumb route?
from xng-breadcrumb.
I also want to change breadcrumb routing dynamically, in my situation, I route back to different component based on user's role.
that logic is in home component. (not in app-routing.module.ts) @udayvunnam could you please let me know is there any workaround for modifying/assigning routes in runtime.
Thank you
/Shamal.
from xng-breadcrumb.
@roshanjayawardena @ShamalFdo129 Can you be able to provide a http://stackblitz.com/ minimal example with your use case for updating the breadcrumb route dynamically.
from xng-breadcrumb.
Hi Uday,
@udayvunnam
Please could you please give us a update
Thank you.
from xng-breadcrumb.
@udayvunnam
Hi Uday,
Thank you for spending time on our request. Appreciate if you could suggest a workaround for us if a fix takes some time to rollout.
Thanks and Regards,
/Shamal
from xng-breadcrumb.
@roshanjayawardena @ShamalFdo129 I am coming up with a solution like below.
- Provide routeInterceptor callback either in RouteConfig if you know the redirection logic upfront
{
path: '',
pathMatch: 'full',
component: HomeComponent,
data: {
breadcrumb: {
label: 'my home',
info: 'home',
routeInterceptor: (routeLink, breadcrumb)=> {
console.log(routeLink);
return routeLink;
}
},
},
}
- If you want to access Application context, set this interceptor from within the component
const isDesigner = true;
breadcrumbService.set('home', {routeInterceptor: (routeLink, breadcrumb)=> isDesigner ? '/designer' : routeLink});
from xng-breadcrumb.
Let me know if you need any other context as part of this.
from xng-breadcrumb.
@roshanjayawardena @ShamalFdo129 upgrade to the latest version i.e 6.3.0 to get this functionality - https://github.com/udayvunnam/xng-breadcrumb/releases/tag/v6.3.0
from xng-breadcrumb.
@udayvunnam
Hi Uday,
Thank you very much for your help and this perfectly matched with our requirement. I believe this feature helps whole community when changing breadcrumb route dynamically.
Thanks and Regards,
/Shamal
from xng-breadcrumb.
@udayvunnam
Hi Uday,
Thank you very much for your support and for spending your time on this. This feature helped me to achieve my task.I also believe this feature helps the whole community.
Thanks
Roshan
from xng-breadcrumb.
Related Issues (20)
- Errors after updating to Angular 14 HOT 3
- Breadcrumb link disappears on CanDeactivate guard check HOT 4
- Accessibility on breadcrumb's separator HOT 3
- "[preserveQueryParams]" is not working after page refreshed. HOT 4
- Translation Support HOT 2
- Unable to setup breadcrumb for certain route paths HOT 7
- Breadcrumbs are not displayed for lazy loaded module HOT 3
- update xng-breadcrumb demo app that uses Material UI HOT 7
- Module not found when using BreadcrumbService from another module in which the BreadCrumbsModule is imported HOT 2
- Set multiple breadcrumbs regardless of route HOT 11
- Need docs! HOT 2
- xng-breadcrumb not working in Angular Ionic HOT 2
- Hiding the breadcrumbs with one level only HOT 3
- Breadcrumb doesn't work on routes using `matcher` HOT 5
- Property '"autoGenerate"' is incompatible with index signature. HOT 3
- Double rendering with provideClientHydratation Angular 16 HOT 4
- Customizing breadcrumb HOT 3
- Breadcrumb Links Not Working HOT 4
- Breadcrumb labels no longer working with loadChildren HOT 5
- Duplicate breadcrumbs on Angular 17 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xng-breadcrumb.