我是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)