我使用Angular 5和版本5.2.9并且我使用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>
&#13;
答案 0 :(得分:0)
原因可能是该函数缺少括号:
{{reasonsModal.getData}}
实际上应该是什么时候
{{reasonsModal.getData()}}