0

I am not sure what I am doing wrong here, but my dialog does not seem to be utilizing my sections. This is how I am laying out the dialog:

Stackblitz Example

<ng-container ngProjectAs="[mat-dialog-title]">
  <app-dialog-header header="Command Line Arguments"></app-dialog-header>
</ng-container>

<div mat-dialog-content fxLayout="column" fxLayoutGap="5px">
  <textarea rows="15" class="primary-background"></textarea>
</div>

<div mat-dialog-actions fxLayout="row" fxLayoutAlign="space-between center">
  <button mat-button>Cancel</button>
  <button mat-button color="accent">Save</button>
</div>

This is how it looks when I am at the top of the dialog.

Scroll top

This is how it looks when I scroll to the bottom of the dialog.

Scroll bottom

According to the documentation when using [mat-dialog-title] the title should stick to the top, and when using [mat-dialog-actions] the actions should stick to the bottom of the dialog. As seen in the screen shots, that is not happening.

This is how I am opening the modal:

  showCmdArgsDialog() {
    this.dialog.open(CmdArgsDialogComponent, {
      width: '75vw',
      height: '80vh',
      panelClass: 'cmd-args-dialog'
    })
  }
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338

2 Answers2

1

It is not sticky because of dialog options:

{
  width: '75vw',
  height: '400px',
}

But it still has some issues with FlexLayoutModule and app-dialog-header component. It works fine with native mat-dialog-title. See StackBlitz.

Ruslan Lekhman
  • 696
  • 5
  • 9
0

I suspect the issue might be coming how angular components are compiled

If you notice in browser elements window (screenshot below) you can see that mat-dialog-title is shown under app-dialog-header element, however, it should be the other way around. As other answer mentions that with native mat-dialog-title this works fine.

enter image description here

kuldeep
  • 817
  • 10
  • 27