angular-ui/bootstrap — pull request #1399 by mghardy (2013-12-13 00:21:30+00:00)
Title: refactor(modal): change watch expression to check local binding

$$stackedMap data structure has a length() function to check number of opened modals. 'modal-open' class on body is maintained by $watch expression. It was monitoring openedWindows.length which is always non-zero (since it's a function). $watch expression now watches openedWindows.length() and hands this value to listener callback local binding noOfModals.