Skip to content

Commit dfee6f1

Browse files
authored
CARCATDEV-13967 add templating for title in sidebar layout (#239)
1 parent 30bfae9 commit dfee6f1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

projects/material-addons/src/lib/layout/sidebar-layout/sidebar-layout.component.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
<button class="back-button" *ngIf="hasBackButton">
1010
<mat-icon (click)="goToPreviousPage()" color="primary"> arrow_back</mat-icon>
1111
</button>
12-
<h2 class="title">
13-
{{ title }}
14-
</h2>
12+
<ng-container *ngIf="titleTemplate; else textTitle">
13+
<ng-container *ngTemplateOutlet="titleTemplate"></ng-container>
14+
</ng-container>
15+
16+
<ng-template #textTitle>
17+
<h2 class="title">{{ title }}</h2>
18+
</ng-template>
1519
</div>
1620
<ng-template [cdkPortalOutlet]="actionGroupPortal"></ng-template>
1721
</div>

projects/material-addons/src/lib/layout/sidebar-layout/sidebar-layout.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Router, RouterModule } from '@angular/router';
1414
export class SidebarLayoutComponent {
1515
@Input() title: string = '';
1616
@Input() hasBackButton = true;
17+
@Input() titleTemplate: TemplateRef<unknown> | null;
1718

1819
@Input({ required: true }) set sideBarItems(ref: TemplateRef<unknown>) {
1920
this.sideBarItemsPortal = new TemplatePortal(ref, this._viewContainerRef);

0 commit comments

Comments
 (0)