在顶部对齐动态对话框

Align Dynamic Dialog on top

是否可以在打开时将 Dynamic Dialog 组件对齐到顶部?

我正在使用建议的显示方式:

show() {
    const ref = this.dialogService.open(CarsListDemo, {
        header: 'Choose a Car',
        width: '70%'
    });
}

您需要在打开的对话框中传递'style'(组件的内联样式)对象。

 onClick() {
    this.dialogService.open(DialogComponent,
     {
      style: {
         backgroundColor: '#fff',
        // 'min-width': '100px',
        // 'min-height': '100px',
        position: 'absolute',
        overflow: 'auto',
        top: '300px',
        right: '100px',
        bottom: 0,
        left: 500,
        'overflow-y': 'auto',
      },
      header: 'Choose a Car',

    });
  }

演示在这里 https://stackblitz.com/edit/github-fxeygh-zala3a