Angular 将HTML传递到Mat对话框中
我试图将HTML作为消息参数传递到Mat对话框代码中。因此,我有以下内容,但不确定如何将HTML传递到其中Angular 将HTML传递到Mat对话框中,angular,angular-material,Angular,Angular Material,我试图将HTML作为消息参数传递到Mat对话框代码中。因此,我有以下内容,但不确定如何将HTML传递到其中 openAlertDialog() { const dialogRef = this.dialog.open(AlertDialogComponent,{ data:{ message: '<!DOCTYPE html><html><body><h1>My First Heading</h1>
openAlertDialog() {
const dialogRef = this.dialog.open(AlertDialogComponent,{
data:{
message: '<!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>',
buttonText: {
cancel: 'Done'
}
},
});
}
openAlertDialog(){
const dialogRef=this.dialog.open(AlertDialogComponent{
数据:{
信息:“我的第一个标题我的第一段。”,
按钮文字:{
取消:“完成”
}
},
});
}
我想在消息中添加HTML
我这里有一堆代码
你知道我该怎么做吗?你可以使用innerHTML属性显示你的HTML消息。把它改成下面的
<mat-dialog-content [innerHTML]="message">
</mat-dialog-content>
工作时您可以使用innerHTML属性显示HTML消息。把它改成下面的
<mat-dialog-content [innerHTML]="message">
</mat-dialog-content>
工作