Skip to content

Angular - Support dynamic URLs for breadcrumbs #22931

Open
@yonguelink

Description

@yonguelink

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

The issue #4649 was closed without an apparent feature (bug?) added to support dynamic URLs, such as the example in the issue /appointments/:someId - if we use dynamic URLs in the components, the breadcrumbs defaults back to only the Home section because the exact URL is not found in the routing component, therefore the segments builts by the breadcrumb.component.ts are never actually filled up.

One suggested workaround was to add the current entitie's URL in the breadcrumbs directly in the component, however that's not an approach an enterprise-grade solution should have to do.

Describe the solution you'd like

RoutesService should handle dynamic URL definition (:dynamicPart) in the routing when searching for a route that matches the current route & build the breadcrumbs from there instead of relying on URLs that match 1 for 1.

Another alternative would be to default to the next parent of the current URL, as in if the current URL is not found in the defined routing, check if the parent's found instead and build the breadcrumbs from there instead - it won't display the current page but at least will not only display the Home page. This approach also has the advantage to not have to deal with multiple nested dynamic urls (such as /appointment/:someId/details/:someOtherParam), if something's not found, move to the parent, until there are no more parents left & only Home is present.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions