Page 1 of 1

Breadcrumb observable not working (setItems)

Posted: 05 Sep 2021, 23:48
by koleshy
Hello guys, the Breadcrumb observable is not working, I can't find the problem.
I follow the examples and did the same but the handler is not detecting setItems
on my new custom page component i already did:

constructor(private breadcrumbService: AppBreadcrumbService) {
this.breadcrumbService.setItems([
{ label: 'Operaciones' },
{ label: 'Emitir Factura', routerLink: [`/custom`] }
]);
}

on the app.breadcrumb.component.ts the subscribe is not working, the items is never set:

this.subscription = this.breadcrumbService.itemsHandler.subscribe(response => {
this.items = response;
console.log('breadcrumb.items', this.items); //never show
});

on the app.main.component.html is already:

<div class="layout-main">
<app-breadcrumb></app-breadcrumb>

<div class="layout-content">
<router-outlet></router-outlet>
</div>

<app-footer></app-footer>
</div>

Re: Breadcrumb observable not working (setItems)

Posted: 08 Sep 2021, 14:06
by merve7
Hi,

Could you check your app.breadcrumb.service.ts file and providers part in your app.module.ts file? Also, do you have any error or warning messages?

Best regards,
Merve Özçifçi

Re: Breadcrumb observable not working (setItems)

Posted: 08 Sep 2021, 17:34
by koleshy
Hello my friend, there is no error in the console my pages components works fine

I use a custom PrimeNg module to group PrimeNg components/services

Image

I import this custom PrimeNg module on my App module

Image

app.main.component.html
Image

app.breadcrumb.component.html
Image

app.breadcrumb.component.ts
Image

app.breadcrumb.service.ts
Image

app-routing.module.ts
Image