angular-ui/bootstrap — pull request #1574 by emgeee (2014-01-14 05:12:25+00:00)
Title: modal close/dismiss methods wait for modalOpenDeferred to resolve

If you attempt to call dismiss() or close() on a modal instance before it has finished opening the function errors out. This is fixable by waiting until after the modalOpenedDeferred promise is fulfilled.