Tus*_*osh 2 typescript bootstrap-modal angular
我是anguar4的新手。我在我的项目中使用引导模式。当在模态之外单击时,模态将隐藏。这是我的代码
//在html中
<div bsModal #noticeModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myLargeModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
Hello World
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
// 在 ts 代码中
@ViewChild('noticeModal') public noticeModal: ModalDirective;
ngAfterViewInit() {
this.noticeModal.show();
};
Run Code Online (Sandbox Code Playgroud)
小智 11
请在 html 中添加此配置。希望它能帮助您解决问题。
<div bsModal #noticeModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
[config]="{backdrop: 'static', keyboard: false}"
aria-labelledby="myLargeModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
Hello World
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9200 次 |
| 最近记录: |