Browse Source

Added TrackBy in breadcrumb

pull/3463/head
Vladyslav_Prykhodko 5 years ago
parent
commit
784febf3fc
  1. 2
      ui-ngx/src/app/shared/components/breadcrumb.component.html
  2. 4
      ui-ngx/src/app/shared/components/breadcrumb.component.ts

2
ui-ngx/src/app/shared/components/breadcrumb.component.html

@ -19,7 +19,7 @@
<h1 fxFlex fxHide.gt-sm *ngIf="lastBreadcrumb$ | async; let breadcrumb">
{{ breadcrumb.ignoreTranslate ? (breadcrumb.labelFunction ? breadcrumb.labelFunction() : breadcrumb.label) : (breadcrumb.label | translate) }}
</h1>
<span fxHide.lt-md fxLayout="row" *ngFor="let breadcrumb of breadcrumbs$ | async; last as isLast;" [ngSwitch]="isLast">
<span fxHide.lt-md fxLayout="row" *ngFor="let breadcrumb of breadcrumbs$ | async; trackBy: trackByBreadcrumbs; last as isLast;" [ngSwitch]="isLast">
<a *ngSwitchCase="false" [routerLink]="breadcrumb.link" [queryParams]="breadcrumb.queryParams">
<mat-icon *ngIf="breadcrumb.isMdiIcon" [svgIcon]="breadcrumb.icon">
</mat-icon>

4
ui-ngx/src/app/shared/components/breadcrumb.component.ts

@ -110,4 +110,8 @@ export class BreadcrumbComponent implements OnInit, OnDestroy {
}
return newBreadcrumbs;
}
trackByBreadcrumbs(index: number, breadcrumb: BreadCrumb){
return breadcrumb.labelFunction ? breadcrumb.labelFunction() : breadcrumb.label;
}
}

Loading…
Cancel
Save