[英]Can you get the 'x' (close) button on a bootstrap modal to call a javascript function instead of closing the modal?
[英]Call a function on bootstrap modal close(Both through escape button and any other way) in angular
我正在使用 angular。 我有Bootstrap模式彈出窗口。 當它關閉時,我已經調用了 function。 但問題是還有其他關閉方式,比如按下退出按鈕或簡單地點擊屏幕。 當這些事件如逃逸發生時,我不知道如何調用相同的 function? 我用谷歌搜索了stackoverflow,找不到合適的解決方案。
您可以在hide.bs.modal
事件上添加一個均勻的偵聽器。 這甚至會在調用 hide 實例方法時立即觸發。 您可以在文檔中查看更多詳細信息
您可以使用模態元素的blur
事件。 並且onBlur
做任何你想做的事。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.