angular-ui/bootstrap — pull request #3029 by zaknuces (2014-11-28 08:16:51+00:00)
Title: fix(Modal): Use attribute observe and add a render promise.

There are two issues with Modal.
1) Modal Directive relays on timeout service to set the animation and focus. The better alternate is to use attribute service's observe method. It is more consistent then $timeout.

2) As of now, there is no way of knowing whether the modal is rendered or DOM ready. Opened promise is pretty useless as it will only notify that template and resolves are resolves successfully or rejected. To solve this, we can have one more promise called 'rendered' which will be settled when modal is rendered.

Pros:
- User can manipulate DOM (if needed) when rendered promise is settled.
- Avoid any race conditions in the scenarios where the modal content dependents on the dimension of the container. Like setting the maximum height of the modal content element on the basis of modal dialog height etc.

Short Coming:
- We should reject rendered promise if rendering takes more than allotted time.