ncuillery / angular-breadcrumb

Generate a breadcrumb from ui-router's states
http://ncuillery.github.io/angular-breadcrumb/
MIT License
785 stars 183 forks source link

hide parent crumb if parent is current. #163

Open DickSwart opened 8 years ago

DickSwart commented 8 years ago

Hi thanx for this great module, I would like to know if it is possible to not show the breadcrumb if the parent state is the current state?

To explain a bit more, lets say I have a 'Dashboard' state that I will set as prefixStateName so that all breadcrumb will have the Dashboard as the first step. But when I'm on the dashboard I don't want to display any breadcrumb.

Not on dashboard: Dashboard / Something / SomethingElse (Something is not a child state of Dashboard)

On Dashboard: Don't display breadcrumbs.

ravimallya commented 7 years ago

Yes. this is what I also wanted to know.

   $stateProvider
      .state('main', {
          abstract: true,
          url: '',
          templateUrl: '/app/views/pages/landing-main.html',
          data: {
              requireLogin: false
          } 
      })
      .state('main.home', {
          parent: 'main',
          url: '/',
          templateUrl: '/app/views/pages/landing-main/home.html',
          controller: 'mainCtrl',
          ncyBreadcrumb: {
              label: 'Home'
          }
      })
         .state('main.aboutus', {
             parent: 'main',
             url: '/about-us',
             templateUrl: '/app/views/pages/static_pages/aboutus.html',
             data: {
                 requireLogin: false
             },
             ncyBreadcrumb: {
                 label: 'About Us'
             }
         })

I wanted to hide the breadcrumbs for main.home state. I've added following HTML to landing-main.html template.

<div class="container">
    <div ncy-breadcrumb></div>
</div>
ultralabed commented 7 years ago

Yes, I would kindly want to know if it is possible to 'hide parent crumb if parent is current'? Thanks~!