angular-ui/bootstrap — pull request #232 by anton-dev-ua (2013-03-18 05:55:35+00:00)
Title: Dialog does not destroy scope/watchers on close

Hi

I found next issue in a dialog module.
When dialog is opening it creates new scope. But it does not destroy this scope when it is closing. So amount of scopes (and watchers, etc.) increases with every reopening of the dialog.

I created the Plunker to illustrate the issue: http://plnkr.co/edit/sPhpu9?p=preview

I think adding something like this.$scope.$destroy() at the end of _onCloseComplete() can resolve the issue, if I don't miss something:
```javascript
Dialog.prototype._onCloseComplete = function(result) {
this._removeElementsFromDom();
this._unbindEvents();

this.deferred.resolve(result);

this.$scope.$destroy();
};
```

Thanks

Regards,
Anton