abpframework / abpframework/abp
Angular - Support dynamic URLs for breadcrumbs
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 14.4k
- Forks
- 3.7k
- Avg merge
- 15h 32m
- Merged PRs (30d)
- 106
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with npm/ng-packs/packages/theme-shared/src/lib/components/breadcrumb/breadcrumb.component.ts and trace how RoutesService searches for the current route and populates segments. Compare the requested dynamic URL matching with the suggested parent-route fallback. Done means breadcrumbs for routes such as /appointments/:someId no longer default to only Home.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100