angular-ui/bootstrap — pull request #14 by maxisam (2012-11-02 16:59:07+00:00)
Title: Update src/modal/modal.js

I ran into an issue if you have multiple modal, the backdrop somehow will be messed up.

Since the var backdropEl;is shared across the directives, only one backdrop element will be inserted to body.

Therefore if you open a second modal before closing the first one and close it, the screen will have no backdrop when the first modal remains open.

I think there are two ways to fix this.

Movevar backdrop into link function, so every modal has its own backdrop.

Having a counter across the directives for keeping track how many modal is opened.

And elm.parent().append(backdropEl); instead of body.append(backdropEl);
in case the modal is inside of a template, when you load template, the a new backdrop will be appended to body.