简体   繁体   English

Angular-ui模态指令

[英]Angular-ui modal directive

Towards the end of the documentation for Angular UI modal directive , it is written 接下来是Angular UI模态指令的文档末尾

In addition the scope associated with modal's content is augmented with 2 methods: * $close(result) * $dismiss(reason) Those methods make it easy to close a modal window without a need to create a dedicated controller

I see this is implemented in commit http://github.com/angular-ui/bootstrap/commit/8d153acb 我看到这是在提交http://github.com/angular-ui/bootstrap/commit/8d153acb中实现的

Is there any example on how to use it. 有没有关于如何使用它的例子。 I too like to avoid writing a controller for the example given in the doc. 我也想避免为doc中给出的示例编写控制器。 plnkr . plnkr So, I am seeking a way to avoid creating ModalInstanceCtrl for simple functionalities (input through a form, displaying some data). 因此,我正在寻找一种方法来避免为简单的功能创建ModalInstanceCtrl (通过表单输入,显示一些数据)。

在你的模态形式中只需使用:

<button ng-click="$close(result)">OK</button>

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

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