正如标题所示,我目前正在与星云对话的角度进行斗争。默认情况下,它是居中的,我希望它直接对齐到我屏幕的右边。
在googling了很长一段时间之后,我尝试的是调用component.ts
中的对话框,如下所示:
this.dialogRef = this.dialogService.open(this.noteDialog, { dialogClass: 'stick-right' });
然后在我的themes.scss
中添加一些scss
.stick-right {
display: flex !important;
justify-content: flex-end !important;
align-items: center !important;
}
这是在检查浏览器中的元素时所做的一些html输出(简化)
<div class="cdk-global-overlay-wrapper" style="justify-content: center; align-items: center;">
<div class="cdk-overlay-pane stick-right" style="position: static;">
<app-notes></app-notes>
</div>
</div>
如您所见,dialogClass: 'stick-right'
应用于第二个<div>
。因此,这里的问题似乎是,我需要将scss
应用于第一个<div>
,而不是第二个。
如果可能的话,有谁能从NbDialog
本身得到线索,或者有一个有效的解决方案?
提前感谢!
发布于 2022-01-12 10:37:04
好吧我终于发现自己..。我真的不是jquery的朋友,但在这种情况下,它似乎是完成此操作的唯一机会(直到父选择器被添加到css中为止).
这样,stick-right
类将被添加到带有类cdk-global-overlay-wrapper
的div元素中。
$('.cdk-overlay-pane').closest('.cdk-global-overlay-wrapper').addClass('stick-right');
https://stackoverflow.com/questions/70671119
复制相似问题