該對話框在Firefox中正常工作。在Chrome中,點擊事件只是顯示一個沒有內容或按鈕的小空對話框。當我遇到問題時,我正在通過this工作。爲什麼Google Chrome中沒有顯示Angular Material對話框組件?
DialogComponent:
@Component({
selector: 'dialog',
template: `
<h1 md-dialog-title class="primary-color">hey title</h1>
<md-dialog-content class="accent-color">
hey this is the content of the dialog
</md-dialog-content>
<md-dialog-actions>
<button md-raised-button color="primary" md-dialog-close>
close button
</button>
</md-dialog-actions>
`
})
AppComponent HTML:
<div>
<button md-raised-button color="primary" (click)="openDialog()">
Example Dialog - Click Me!
</button>
</div>
AppComponent功能:
constructor(public dialog: MdDialog) {}
openDialog() {
this.dialog.open(DialogComponent);}
是否有一些具體的事情我必須做的,使其在谷歌Chrome瀏覽器的工作?
您是否已將DialogComponent導入到'AppModule'文件中的'entryComponents'和'declarations'中? – Edric
是的,我做過。它似乎在Firefox中正常工作。在Chrome中,打開對話框時不會顯示標題,內容或操作。 – Nicholas