模态打开但不显示内容 - ngx-smart-modal

时间:2018-04-04 13:38:49

标签: modal-dialog angular5

我使用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();

&#13;
&#13;
<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;
&#13;
&#13;

Error in image

1 个答案:

答案 0 :(得分:0)

原因可能是该函数缺少括号:

{{reasonsModal.getData}}

实际上应该是什么时候

{{reasonsModal.getData()}}