简体   繁体   中英

Passing parameter during closing modal with ESC key

Is there a way to pass a parameter through the $modalInstance.dismiss when we close a modal using ESC key? If user close properly using 'close', then I know I can use $modalInstance.close(ctrl.anyParam) and if I use cancel button I can use $modalInstance.dismiss(ctrl.anyParam) . This works fine since I have the promise from $modalInstance.open and depending on what user click, I can handle if the promise is resolved or rejected.

However, in the case where user click ESC, can I pass ctrl.anyParam so I can handle it in my reject promise? I created plunkr here to describe my question.

唯一可以做的是通过更改config的配置并通过注册一个键侦听器以编程方式执行关闭动作(使用给定参数)来防止默认情况下使用ESC关闭模式,因为没有传递指定的参数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM