[英]mat-dialog not filling screen - Angular
I have an image carousel inside a mat-dialog.我在垫子对话框中有一个图像轮播。 It doesn't really matter what component I feed the mat-dialog.我为 mat-dialog 提供什么组件并不重要。 They never fill the screen so I don't think it's the specific component inside mat-dialog that's the issue.它们永远不会填满屏幕,所以我认为这不是 mat-dialog 中的特定组件的问题。
I want it to fill the width 100% and height:auto
to make the image fit correctly, but it doesn't seem to work and I have no idea why.我希望它填充宽度 100% 和height:auto
以使图像正确适合,但它似乎不起作用,我不知道为什么。
openImageGalleryMobile(images) {
const imageDialogRef = this.dialog.open(ImageCarouselComponent, {
panelClass: "matdialogStyle",
data: { images: images},
height: 'auto',
width: '100%',
});
imageDialogRef
.afterClosed()
.pipe(takeUntil(this.destroy))
.subscribe(result => { });
}
<div id="imageSlideshow">
<ngb-carousel *ngIf="images">
<ng-template ngbSlide *ngFor="let image of images">
<img src='{{image}}' alt="Random first side">
</ng-template>
</ngb-carousel>
</div>
I tried adding .matdialogStyle
as a new unaltered css class, but issue is still there.我尝试将.matdialogStyle
添加为一个新的未.matdialogStyle
css 类,但问题仍然存在。 I tried setting the width to 100% from component css file or styles.css file using matdialogStyle
css class, but it never updates.我尝试使用matdialogStyle
css 类将组件 css 文件或matdialogStyle
文件的宽度设置为 100%,但它永远不会更新。 I appreciate the help!我感谢您的帮助!
Can you try :你能试一下吗 :
{
panelClass: "matdialogStyle",
data: { images: images},
height: 'auto',
minWidth: '100%',
}
and you can add for height 100% :你可以添加高度 100% :
minHeight: '100vh'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.