該對話框顯示在我的頁面底部,具有奇怪的外觀和行爲! 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