Disabling Certain paths for Breadcrumbs of NgZorro

75 Views Asked by At

How can I change dynamically generated breadcrumbs? I have a breadcrumb lets say Settings/User/Profile but want to disable User from rediecting to a no-content page,which is generated using [nzAutoGenerate] which is loading my lazy-loaded Breadpaths perfectly but am getting perfectlyhow do i disable certain paths either from the routing file or from the breadcrumb component itself

<nz-breadcrumb [nzAutoGenerate]="true">
   <nz-breadcrumb-item *ngFor="let _breadCrumb of breadCrumbs" class="crum-title">
        <i *ngIf="_breadCrumb.icon" nz-icon [nzType]="_breadCrumb.icon"></i>
   </nz-breadcrumb-item>
</nz-breadcrumb>

where the variable breadcrumb contains breadcrumb= [{children:[],icon:'home':key:'/settings/user/index',title:"/settings/user/index"}]

and the routing module i have is lazy loaded which looks like this [

//settings-routing.module.ts
[
  path: '',
  canActivate: [AuthGuard],
  children: [
    {
      path: '',
      redirectTo: 'user',
      pathMatch: 'full',
    },
    {
      path: 'user',
      loadChildren: () =>
        import('../settings/user/user.module').then(
          (m) => m.UserModule
        ),
      data: {
        role: [],
        breadcrumb: 'User',
      },
      canActivate: [AuthGuard],
    },
  ]
]

] user routing file

[
  {
    path: '',
    children: [
      {
        path: '',
        redirectTo: 'profile',
        pathMatch: 'full',
        data: {
          label: 'User',
          breadcrumb: 'User',
        },
      },
      {
        path: 'user',
        canActivate: [AuthGuard],
        data: {
          label: 'User',
          breadcrumb: 'User'
        },
        children: [
          {
            path: 'profile',
            component: userProfileComponent,
            canActivate: [AuthGuard],
            data: {
              breadcrumb: 'Profile',
              routerData: {
                plantDropdown: false,
                date: '',
              },
            },
          },
        ]
      }
    ]
  }
]

Wanted Breadcrumbs paths that can disable even when lazy-loaded. tried to pass a variable from routing like disable: true but was not working properly because of the breadcrumb varaiable data, which ill have to reformat into a different dataset

0

There are 0 best solutions below