Giter Club home page Giter Club logo

Comments (14)

udayvunnam avatar udayvunnam commented on May 28, 2024 2

@roshanjayawardena thanks for the reproducible example. I will rollout a fix likely this week

from xng-breadcrumb.

udayvunnam avatar udayvunnam commented on May 28, 2024 2

@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.

roshanjayawardena avatar roshanjayawardena commented on May 28, 2024 1

Hi Uday, @udayvunnam ,

Please refer the below link
https://stackblitz.com/github/roshanjayawardena/mybreadcrumb

image

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.

roshanjayawardena avatar roshanjayawardena commented on May 28, 2024 1

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.

roshanjayawardena avatar roshanjayawardena commented on May 28, 2024

can't we retrieve the routing values of breadcrumb object?
Can't we update the breadcrumb route?

from xng-breadcrumb.

ShamalFdo129 avatar ShamalFdo129 commented on May 28, 2024

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.

udayvunnam avatar udayvunnam commented on May 28, 2024

@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.

roshanjayawardena avatar roshanjayawardena commented on May 28, 2024

Hi Uday,
@udayvunnam

Please could you please give us a update

Thank you.

from xng-breadcrumb.

ShamalFdo129 avatar ShamalFdo129 commented on May 28, 2024

@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.

udayvunnam avatar udayvunnam commented on May 28, 2024

@roshanjayawardena @ShamalFdo129 I am coming up with a solution like below.

  1. 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;
        }
      },
    },
  }
  1. 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.

udayvunnam avatar udayvunnam commented on May 28, 2024

Let me know if you need any other context as part of this.

from xng-breadcrumb.

udayvunnam avatar udayvunnam commented on May 28, 2024

@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

Usage: https://github.com/udayvunnam/xng-breadcrumb#intercept-the-routing-via-breadcrumb-navigation---routeinterceptor

from xng-breadcrumb.

ShamalFdo129 avatar ShamalFdo129 commented on May 28, 2024

@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.

roshanjayawardena avatar roshanjayawardena commented on May 28, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.