Skip to content

Commit

Permalink
feat(window): template as window title (#2915)
Browse files Browse the repository at this point in the history
  • Loading branch information
katebatura authored Oct 31, 2021
1 parent aafceac commit 8eaf460
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/framework/theme/components/window/window.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ import { NbWindowRef } from './window-ref';
template: `
<nb-card>
<nb-card-header>
<div cdkFocusInitial class="title" tabindex="-1">{{ config.title }}</div>
<div *ngIf="config.titleTemplate; else textTitleTemplate" cdkFocusInitial tabindex="-1">
<ng-container *ngTemplateOutlet="config.titleTemplate; context: {$implicit: config.titleTemplateContext}"></ng-container>
</div>
<ng-template #textTitleTemplate>
<div cdkFocusInitial class="title" tabindex="-1">{{ config.title }}</div>
</ng-template>
<div class="buttons">
<ng-container *ngIf="showMinimize">
Expand Down
11 changes: 11 additions & 0 deletions src/framework/theme/components/window/window.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ export class NbWindowConfig {
*/
title: string = '';

/**
* Window title as template. Use it instead of `title` property.
*/
titleTemplate?: TemplateRef<any>;

/**
* Title as template may receive data through `config.titleTemplateContext` property.
* Window title as Template. You can access context inside template as $implicit.
*/
titleTemplateContext?: Object = {};

/**
* Initial window state. Full screen by default.
*/
Expand Down

0 comments on commit 8eaf460

Please sign in to comment.