Angular2 mdldialogservice滚动内容

时间:2017-04-27 12:09:14

标签: angular

我正在使用MdlDialogService从我的主页组件打开帮助对话框:

openHelpDialog(){

    this.dialogService.showCustomDialog({
        component: HelpComponent,
        animate: true,
        isModal: true,
        styles: {'width': '500px', 'overflow-y':'scroll'},
        clickOutsideToClose: true

    })
}

在我的app组件中:

<app-home></app-home>
<dialog-outlet></dialog-outlet>

现在,当我有很多帮助内容时,模态高度就会被切断:

enter image description here

如何将高度限制为某个%,然后使用滚动查看内容?

2 个答案:

答案 0 :(得分:1)

使用css max hight proprty。 css max hegight property

max-height:250px for styles属性。

答案 1 :(得分:0)

我刚刚添加了样式的max-height,如下所示:

    this.dialogService.showCustomDialog({
        component: HelpComponent,
        animate: true,
        isModal: true,
        styles: {'width': '500px', 'max-height':'500px' ,'overflow-y':'scroll'},
        clickOutsideToClose: true

    })