File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed
Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -7,17 +7,25 @@ import {
77@Component ( {
88 selector : "ibm-breadcrumb-item" ,
99 template : `
10+ <a class="bx--link"
11+ href="/#"
12+ *ngIf="skeleton">
13+ <ng-container *ngTemplateOutlet="content"></ng-container>
14+ </a>
15+
1016 <a class="bx--link"
1117 href="{{href}}"
12- *ngIf="href; else content">
18+ *ngIf="!skeleton && href; else content">
1319 <ng-container *ngTemplateOutlet="content"></ng-container>
1420 </a>
1521 <ng-template #content>
1622 <ng-content></ng-content>
1723 </ng-template>`
1824} )
1925export class BreadcrumbItemComponent {
20- @Input ( ) href = "/#" ;
26+ @Input ( ) href : string ;
27+
28+ @Input ( ) skeleton = false ;
2129
2230 @HostBinding ( "class.bx--breadcrumb-item" ) itemClass = true ;
2331}
Original file line number Diff line number Diff line change 11import {
22 Component ,
3- Input
3+ Input ,
4+ ContentChildren ,
5+ QueryList ,
6+ AfterContentInit
47} from "@angular/core" ;
58
69import { BreadcrumbItem } from "./breadcrumb-item.interface" ;
10+ import { BreadcrumbItemComponent } from "./breadcrumb-item.component" ;
711
812const MINIMUM_OVERFLOW_THRESHOLD = 4 ;
913
@@ -51,7 +55,9 @@ const MINIMUM_OVERFLOW_THRESHOLD = 4;
5155 </ng-template>
5256 </nav>`
5357} )
54- export class Breadcrumb {
58+ export class Breadcrumb implements AfterContentInit {
59+ @ContentChildren ( BreadcrumbItemComponent ) childs : QueryList < BreadcrumbItemComponent > ;
60+
5561 @Input ( ) items : Array < BreadcrumbItem > ;
5662
5763 @Input ( ) noTrailingSlash = false ;
@@ -74,6 +80,10 @@ export class Breadcrumb {
7480 return this . _threshold ;
7581 }
7682
83+ ngAfterContentInit ( ) {
84+ this . childs . toArray ( ) . forEach ( child => child . skeleton = this . skeleton ) ;
85+ }
86+
7787 get shouldShowContent ( ) : boolean {
7888 return ! this . items ;
7989 }
You can’t perform that action at this time.
0 commit comments