我使用的是 5.2.9 版的 Angular 5,我使用的是 ngx-smart-modal,当我打开 Modal 时,它不显示内容并且非常接近顶部并缩小,附加的图像已附加。
const reasons = '<h1>Reasons</h1>';
this.ngxSmartModalService.setModalData(this.sanitizer.bypassSecurityTrustHtml(reasons), 'reasonsModal');
this.ngxSmartModalService.getModal('reasonsModal').open();
<ngx-smart-modal #reasonsModal identifier="reasonsModal" (onDismiss)="clearModal()" (onClose)="clearModal()">
<div *ngIf="reasonsModal.hasData()" [innerHTML]="reasonsModal.getData()">
<pre>{{reasonsModal.getData}}</pre>
</div>
<button (click)="reasonsModal.close()">Closes</button>
</ngx-smart-modal>
最佳答案
原因可能是函数上缺少括号:
{{reasonsModal.getData}}
实际上应该是什么时候:
{{reasonsModal.getData()}}