angular-ui/bootstrap — pull request #1393 by tritonrc (2013-12-11 22:57:28+00:00)
Title: fix(modal): Grab reference to body when it is needed in lieu of when the factory is created

We encountered an issue where modals would stop appearing once we navigated (we are using HTML5 mode and have the body element tagged with ngView) to another controller and back (reloading the page makes it work again).

I traced it down to what appears to be a "stale" reference to body in the `$modalStack` factory. This DOM reference is created when the factory is instantiated and then later used when `open` is called.

This pull request simply moves where the body reference is created from the factory instantiation to inside the `open` method where body is actually used. With this patch in place, the modal works as expected after navigating to another controller and back.