Skip to content

Commit e08a22d

Browse files
committed
refactor(breadcrumbs): signal for breadcrumb items
1 parent be1ae5f commit e08a22d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/app/views/base/breadcrumbs/breadcrumbs.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
.
2121
</p>
2222
<app-docs-example href="components/breadcrumb">
23+
@let items = breadcrumbItems();
2324
<c-breadcrumb class="mb-2">
2425
@for (item of items; track item; let i = $index, isLast = $last) {
2526
<c-breadcrumb-item [active]="isLast" [url]="item.url">

src/app/views/base/breadcrumbs/breadcrumbs.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component, OnInit, signal } from '@angular/core';
22
import { NgClass } from '@angular/common';
33
import {
44
BreadcrumbComponent,
@@ -17,25 +17,25 @@ import { DocsComponentsComponent, DocsExampleComponent } from '@docs-components/
1717
imports: [RowComponent, ColComponent, CardComponent, CardHeaderComponent, CardBodyComponent, DocsExampleComponent, BreadcrumbComponent, BreadcrumbItemComponent, NgClass, BreadcrumbRouterComponent, DocsComponentsComponent]
1818
})
1919
export class BreadcrumbsComponent implements OnInit {
20-
public items = <any>[];
20+
public breadcrumbItems = signal<any>([]);
2121

2222
constructor() {}
2323

2424
ngOnInit(): void {
25-
this.items = [
25+
this.breadcrumbItems.set([
2626
{ label: 'Home', url: '/', attributes: { title: 'Home' } },
2727
{ label: 'Library', url: '/' },
2828
{ label: 'Data', url: '/dashboard/' },
2929
{ label: 'CoreUI', url: '/' }
30-
];
30+
]);
3131

3232
setTimeout(() => {
33-
this.items = [
33+
this.breadcrumbItems.set([
3434
{ label: 'CoreUI', url: '/' },
3535
{ label: 'Data', url: '/dashboard/' },
3636
{ label: 'Library', url: '/' },
3737
{ label: 'Home', url: '/', attributes: { title: 'Home' } }
38-
];
38+
]);
3939
}, 5000);
4040
}
4141
}

0 commit comments

Comments
 (0)