Javascript 角度材质-预渲染对话框不';不显示,但背景颜色会改变

Javascript 角度材质-预渲染对话框不';不显示,但背景颜色会改变,javascript,html,css,angularjs,angular-material,Javascript,Html,Css,Angularjs,Angular Material,我正在尝试使用角度材质创建预渲染的模态。当我点击触发模态的按钮时,屏幕变成深灰色(模态背景),就好像模态在那里,但实际模态没有出现。我基本上是直接从Angular Material的演示中复制的,所以我不确定为什么它不起作用 HTML <md-button class="md-raised md-primary"ng-click="vm.showModal($event)"> Add Review </md-button> <md-dialog layou

我正在尝试使用角度材质创建预渲染的模态。当我点击触发模态的按钮时,屏幕变成深灰色(模态背景),就好像模态在那里,但实际模态没有出现。我基本上是直接从Angular Material的演示中复制的,所以我不确定为什么它不起作用

HTML

<md-button class="md-raised md-primary"ng-click="vm.showModal($event)">
     Add Review
</md-button>
<md-dialog layout-padding aria-label="myDialog" id="myDialog" class="dialog">
    <md-dialog-content>
        <h2>Pre-Rendered Dialog</h2>
        <p>
            This is a pre-rendered dialog, which means that <code>$mdDialog</code> doesn't compile its
            template on each opening.
            <br/><br/>
            The Dialog Element is a static element in the DOM, which is just visually hidden.<br/>
            Once the dialog opens, we just fetch the element from the DOM into our dialog and upon close
            we restore the element back into its old DOM position.
        </p>
    </md-dialog-content>
</md-dialog>
CSS

.dialog {
    visibility: hidden;
}
控制器

function showModal(ev) {
      $mdDialog.show({
        contentElement: '#myDialog',
        parent: angular.element(document.body),
        targetEvent: ev,
        clickOutsideToClose: true
      });
}

我继续从Angular Material的演示页面复制,但仍有相同的行为,因此我的配置中一定有错误。我继续从Angular Material的演示页面复制,但仍有相同的行为,因此我的配置中一定有错误。