diff --git a/src/framework/theme/components/window/window.component.ts b/src/framework/theme/components/window/window.component.ts index a14fc2c385..3198f98b09 100644 --- a/src/framework/theme/components/window/window.component.ts +++ b/src/framework/theme/components/window/window.component.ts @@ -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"> diff --git a/src/framework/theme/components/window/window.options.ts b/src/framework/theme/components/window/window.options.ts index 16f46e9b4d..004efb2941 100644 --- a/src/framework/theme/components/window/window.options.ts +++ b/src/framework/theme/components/window/window.options.ts @@ -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. */