Angular2 router, get route data from url, to display breadcrumbs

后端 未结 3 1775
误落风尘
误落风尘 2020-12-01 08:19

I am using angular2 router.

To draw the breadcrumb of an url, lets say site.com/a/b/c/15 I do the following:

  1. Get the route of site.com/a/b/c/15
3条回答
  •  离开以前
    2020-12-01 08:45

    Any breadcrumb solution has to handle -

    1. declarative approach of defining breadcrumbs in Application routing.
    2. dynamic asynchronous way to update any route with a label from the server response.
    3. way to skip specific routes from displaying in breadcrumbs.

    I have created an Angular library to handle all these, called xng-breadcrumbs - https://github.com/udayvunnam/xng-breadcrumb

    feel free to check, An Angular app developed showing the breadcrumbs usage - https://xng-breadcrumb.netlify.com

    Angular library planning, creation, and continuous release is well documented in this medium article

提交回复
热议问题