该对话框显示在我的页面底部,具有奇怪的外观和行为! Angular Material 这里是我的版本一起工作:角度材质对话框显示不正确
@角/材料“: ”^ 2.0.0 beta.8, @角/芯“: ”^ 4.2.6“
我使用引导v3.7.x(我试图用NG-引导模式,并证明它不与引导3再工作下去)
buy.component.html
<button md-button type="button" class="btn btn-primary" (click)="openPaymentWindow()">BUY</button>
个buy.component.ts:
import {MdDialog} from '@angular/material';
import {PaymentModal} from "./paymentModal.component"
@Component({
templateUrl: "./buy.component.html"
})
export class Buy {
constructor(public dialog: MdDialog) {}
openPaymentWindow():void {
const modalInstance = this.dialog.open(PaymentModal);
}
}
paymentModal.component.ts:
import { Component } from '@angular/core';
import {MdDialog, MdDialogRef} from '@angular/material';
@Component({
template: `<div class="modal-body">
Modal content Here
</div>`
})
export class PaymentModal {
constructor(
public dialogRef: MdDialogRef<PaymentModal>) {}
}
How the html of the modal is displayed on botton of my page
您是否在'NgModule'的'entryComponents'下添加了对话框组件? – Edric
另外,如果有的话,你可以分享你的错误日志吗? – Edric
@Edric是的,我做到了! entryComponents:[PaymentModal]!我没有错误!我只是得到我的网页底部的HTML不是模态!我会在问题 – Hazu