简体   繁体   中英

Angular-ui modal directive

Towards the end of the documentation for Angular UI modal directive , it is written

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

Is there any example on how to use it. I too like to avoid writing a controller for the example given in the doc. plnkr . So, I am seeking a way to avoid creating ModalInstanceCtrl for simple functionalities (input through a form, displaying some data).

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

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

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