diff --git a/libs/xng-breadcrumb/src/lib/breadcrumb.component.html b/libs/xng-breadcrumb/src/lib/breadcrumb.component.html
index de907ab..7a8a31b 100644
--- a/libs/xng-breadcrumb/src/lib/breadcrumb.component.html
+++ b/libs/xng-breadcrumb/src/lib/breadcrumb.component.html
@@ -2,7 +2,7 @@
;
separatorTemplate: TemplateRef;
private _separator = '/';
@@ -87,10 +86,18 @@ export class BreadcrumbComponent implements OnInit, OnDestroy {
) {}
ngOnInit() {
- this.subscription = this.breadcrumbService.breadcrumbs$.subscribe(
- (breadcrumbs) => {
- this.breadcrumbs = breadcrumbs
- .map((breadcrumb) => {
+ this.breadcrumbs$ = this.breadcrumbService.breadcrumbs$.pipe(
+ map((breadcrumbs: BreadcrumbDefinition[]) => {
+ return breadcrumbs
+ .filter((breadcrumb: BreadcrumbDefinition) => {
+ // Usually, breadcrumb list can contain a combination of auto generated and user specified labels
+ // this filters autogenerated labels in case of "[autoGenerate]: false"
+ if (this.autoGenerate) {
+ return true;
+ }
+ return !breadcrumb.isAutoGeneratedLabel;
+ })
+ .map((breadcrumb: BreadcrumbDefinition) => {
// Do not mutate breadcrumb as its source of truth.
// There can be scenarios where we can have multiple xng-breadcrumb instances in page
return {
@@ -100,21 +107,10 @@ export class BreadcrumbComponent implements OnInit, OnDestroy {
: undefined,
fragment: this.preserveFragment ? breadcrumb.fragment : undefined,
};
- })
- .filter((breadcrumb) => {
- // Usually, breadcrumb list can contain a combination of auto generated and user specified labels
- // this filters autogenerated labels in case of "[autoGenerate]: false"
- if (this.autoGenerate) {
- return true;
- }
- return !breadcrumb.isAutoGeneratedLabel;
});
- }
+ })
);
}
- ngOnDestroy() {
- this.subscription.unsubscribe();
- }
handleRoute(breadcrumb: BreadcrumbDefinition) {
const routeLink = breadcrumb.routeInterceptor