小编Tus*_*osh的帖子

禁用引导模式区域外的单击事件以关闭 angular 4 模式

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

typescript bootstrap-modal angular

2
推荐指数
1
解决办法
9200
查看次数

标签 统计

angular ×1

bootstrap-modal ×1

typescript ×1