【发布时间】:2021-04-23 12:06:12
【问题描述】:
在打开 ngx-bootstrap-modal 以加载 ngx-image-cropper 时,请注意一些间歇性加载失败。做了一些尝试和错误,我注意到只要我在 loadImageFailed() 触发之前打开模式。裁剪器将加载,一切似乎都工作正常。是否与不渲染到 DOM 有关?
我找不到原因,还是我遗漏了什么?
希望能对此有所了解。
提前致谢。
这是模态的样子:
<!-- EDIT MODAL -->
<article bsModal #lgModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="dialog-sizes-name1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<form (ngSubmit)="instructorService.updateCover(instructor.id)">
<section class="modal-header">
<h4 id="dialog-sizes-name1" class="modal-title pull-left">EDIT BANNER</h4>
<button type="button" class="close pull-right" (click)="lgModal.hide()" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</section>
<section class="modal-body">
<cropper></cropper>
</section>
<section class="modal-footer d-flex bd-highlight">
<div class="mr-auto p-2 bd-highlight">
<input class="overflow-x" type="file" (change)="onSelectFile($event)" hidden #browser>
<button type="button" class="btn btn-pri" (click)="browser.click()"><b>BROWSE</b></button>
</div>
<div class="p-2 bd-highlight">
<button type="button" class="btn btn-sec btn-block"
(click)="lgModal.hide()"><b>CANCEL</b></button>
</div>
<div class="p-2 bd-highlight">
<button type="submit" class="btn btn-dark btn-block px-4"
(click)="lgModal.hide()"><b>SAVE</b></button>
</div>
</section>
</form>
</div>
</div>
</article>
【问题讨论】:
标签: javascript angular lazy-loading ngx-bootstrap ngx-image-cropper