简体   繁体   English

在 angular 中调用 function 在引导模式关闭(通过退出按钮和任何其他方式)

[英]Call a function on bootstrap modal close(Both through escape button and any other way) in angular

I am working with angular.我正在使用 angular。 I have Bootstrap modal popup.我有Bootstrap模式弹出窗口。 I have called a function when its gets closed.当它关闭时,我已经调用了 function。 But the problem is there are other ways to close like pressing escape button or simply clicking on the screen.但问题是还有其他关闭方式,比如按下退出按钮或简单地点击屏幕。 I don't know how to call the same function when these events like escape occur?当这些事件如逃逸发生时,我不知道如何调用相同的 function? I have googled stackoverflow and couldn't find a proper solution.我用谷歌搜索了stackoverflow,找不到合适的解决方案。

Stackblitz 堆栈闪电战

You can add an even listener on hide.bs.modal event.您可以在hide.bs.modal事件上添加一个均匀的侦听器。 This even fires immediately when the hide instance method has been called.这甚至会在调用 hide 实例方法时立即触发。 You can see more detail in the docs您可以在文档中查看更多详细信息

You can use the blur event of your modal element.您可以使用模态元素的blur事件。 And onBlur do whatever you want to.并且onBlur做任何你想做的事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您可以在引导程序模态上使用“ x”(关闭)按钮来调用javascript函数而不是关闭模态吗? - Can you get the 'x' (close) button on a bootstrap modal to call a javascript function instead of closing the modal? Bootstrap 模式 - 单击“号召性用语”按钮时关闭模式 - Bootstrap modal - close modal when “call to action” button is clicked 从叠加层关闭时,Angular ui引导程序模态调用关闭功能 - Angular ui bootstrap modal call close function when closing from overlay 通过脚本函数调用引导程序模式对话框 - call bootstrap modal dialog through script function 在引导模式中单击按钮时调用 JS function - Call JS function on click of a button in a Bootstrap modal 如何使用Angular js和Bootstrap的“取消”按钮关闭模式 - How to close modal with a “Cancel” button with angular js and Bootstrap 有没有一种方法可以在不调用隐藏处理程序的情况下关闭Bootstrap模态 - Is there a way to close Bootstrap modal without call the hidden handler 使用转义键关闭模态的Angular指令 - Angular directive to close a modal with the escape key 使用转义键关闭 Angular 模态的问题 - Problems with escape key to close Angular modal 引导模式不关闭角度js - bootstrap modal not close angular js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM