Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(window): template as window title #2915

Merged
merged 5 commits into from Oct 31, 2021

Conversation

katebatura
Copy link
Contributor

Please read and mark the following check list before creating a pull request:

Short description of what this resolves:

Closes: #2913

how to use:

Two properties have been added to NbWindowConfig:

  • titleTemplate?: TemplateRef<any> use it instead of property title.
  • titleTemplateContext?: Object title as template may receive data through this property.
@Component({
  template: `
    <button (click)="openWindow()" nbButton>Open window</button>

    <ng-template #titleTemplate let-data>
      <p>Here is the text provided via config: "{{ data.text }}"</p>
    </ng-template>
  `
})
export class WindowComponent {
  @ViewChild('titleTemplate') titleTemplate: TemplateRef<any>;

  constructor(private windowService: NbWindowService) {}

  openWindow() {
    this.windowService.open(
      SomeComponent,
      {
        titleTemplate: this.titleTemplate,
        titleTemplateContext: {text: 'some text to pass into template'},
      },
    );
  }
}

@katebatura katebatura requested a review from yggg October 29, 2021 12:38
@katebatura katebatura self-assigned this Oct 29, 2021
@katebatura katebatura changed the title feat(nb window): provide a template to window title feat(window): provide a template to window title Oct 29, 2021
@yggg yggg changed the title feat(window): provide a template to window title feat(window): template as window title Oct 31, 2021
@yggg yggg merged commit 8eaf460 into akveo:master Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nb-window. Provide a template to window title.
2 participants