0.1.281 • Published 7 years ago

ng2-breadcrumbs v0.1.281

Weekly downloads
145
License
MIT
Repository
github
Last release
7 years ago

NOTE: This package is still under development. Contributions are appreciated.

ng4-breadcrumbs

npm version

ng2-breadrumbs is a module for Angular 4 that generates a breadcrumb for any page of your application. It is based on the built-in Angular 4 router.

Usage

Getting started

1.Install ng2-breadcrumbs via npm:

npm install --save ng2-breadcrumbs

2.Import the BreadcrumbsModule within your app:

import {BreadcrumbsModule} from "ng2-breadcrumbs";

@NgModule({
  imports: [ 
    BreadcrumbsModule,
  ],
})

3.Add a name to your route by adding a breadcrumb property in the route's data:

export const routes: Routes = 
[
  {
    path: 'home',
    data: {
      breadcrumb: 'Home',
    },
    component: HomeComponent
  }
]

4.Put the BreadcrumbsComponent's selector within your template:

<breadcrumb></breadcrumb>

Adding dynamic routes

In case you want a dynamic breadcrumb name, you can pass it as a :breadcrumb route parameter when navigating: Route:

   //Add an extra route parameter that will contain the breadcrumb name
		{
			path: ':id/:breadcrumb',
			component: ProfileBreadcrumbDetails,
		}

Router code:

    public name = 'John Doe';
    public id = 3;
    goToDetails() {
        //This will put 'John_Doe' as a route parameter
        this._router.navigate([`/profiles`, this.id, this.name.replace(/ /g,"_")]);
		}

TODO

  1. Add more use cases (using routerLinks, for example).
  2. Document BreadcrumbService.
  3. Add demo.

0.1.281

7 years ago

0.1.28

7 years ago

0.1.272

7 years ago

0.1.271

7 years ago

0.1.27

7 years ago

0.1.26

7 years ago

0.1.25

7 years ago

0.1.24

7 years ago

0.1.23

7 years ago

0.1.22

7 years ago

0.1.21

7 years ago

0.1.20

7 years ago

0.1.19

7 years ago

0.1.18

7 years ago

0.1.17

7 years ago

0.1.16

7 years ago

0.1.15

7 years ago

0.1.14

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

1.2.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.82

7 years ago

1.2.81

7 years ago

1.2.80

7 years ago

1.2.8

7 years ago

1.2.7

7 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.41

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago