我在角度 5 中使用 ngx-bootstrap-modal。
我正在使用以下代码打开模式:-
this.dialogService.addDialog(PopUpComponent, {
title: 'Custom locale',
message: "Hello ? "
}).subscribe((isConfirmed) => {
if (isConfirmed) {
console.log('close...')
}
我工作正常。但是当我在消息中传递 HTML 标签时,HTML 标签不会解析。按原样打印。
this.dialogService.addDialog(PopUpComponent, {
title: 'Custom locale',
message: `<div class="simpleBox">sjdhfjsdhf</div>`
}).subscribe((isConfirmed) => {
if (isConfirmed) {
console.log('close...')
}
它在消息中呈现:<div class="simpleBox">sjdhfjsdhf</div>
.
模态代码如下:-
<div id="NewThemePopUp" class="modal-dialog">
<div class="modal-content">
<div title="Close" (click)="close()" class="newCrossIcon"></div>
<div class="modal-header">
<h4 class="modal-title confirmBlueStrip">{{title || ''}}</h4>
</div>
<div class="modal-body cfUnselectable Pop_up_txt_box newtheme">
{{message || ''}}
</div>
<div class="modal-footer">
<div class="btnRow"><a class="cencel_link btnLink" (click)="close()">Cancel</a> <input
type="button" value="Create" ng-class="CreateThemeButtonClicked? 'btn disabled':'btn'" style="float:right;"
class="btn"></div>
</div>
</div>
</div>