"dismiss" 和 "dismiss" 和有什么不一样?模态和“关闭"Angular UI-Bootstrap 中的模态? [英] What is the difference between "dismiss" a modal and "close" a modal in Angular UI-Bootstrap?

查看:14
本文介绍了"dismiss" 和 "dismiss" 和有什么不一样?模态和“关闭"Angular UI-Bootstrap 中的模态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关闭"模态和关闭"模态有什么区别?

What is the difference between "dismiss" a modal and "close" a modal?

close(result) - a method that can be used to close a modal, passing a result
dismiss(reason) - a method that can be used to dismiss a modal, passing a reason

推荐答案

答案在文档中,就在您引用的两行之后:

The answer is in the documentation, right after the two lines you quoted:

open 方法返回一个模态实例,一个具有以下属性的对象:

The open method returns a modal instance, an object with the following properties:

  • close(result) - 一种可用于关闭模态并传递结果的方法
  • dismiss(reason) - 一种可用于关闭模态并传递原因的方法
  • result - 一个在模态关闭时被解决并在模态被解除时被拒绝的承诺

这里重要的一点是承诺会发生什么.结束时,承诺得到解决 - 本质上,成功"回调触发.在驳回时,承诺被拒绝,因此运行失败"程序.改为回调.

The important bit here being what happens to the promise. On close, the promise is resolved - essentially, the "success" callback fires. On dismiss, the promise is rejected, therefore running the "failure" callback instead.

这篇关于"dismiss" 和 "dismiss" 和有什么不一样?模态和“关闭"Angular UI-Bootstrap 中的模态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆