bsr
bsr

Reputation: 58662

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).

Upvotes: 3

Views: 614

Answers (1)

nyl66
nyl66

Reputation: 300

in your modal form simply use:

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

Upvotes: 4

Related Questions