-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Modal dialog does not disappear with 0.13 and Angular 1.3 when destroying a passed scope #3787
Comments
Workaround is to defer destroying the scope using $timeout or similar method. |
+1 |
So we would be able to adapt the internals so that the promise is not resolved until after the modal window closes, but this could potentially cause a problem - this would be a breaking change that may be undesired, since current behavior is to resolve immediately after the functions are called. One thing that should be noted is that the $scope is never used directly - the service will always do $scope.$new(), so it always works with a descendent scope that gets garbage collected appropriately. Given this, I think your workaround is fine as the resolution for this issue and that there should not be a library modification to support this, except potentially an additional option that gets called on completion of animation of the modal fade out. Thoughts? |
Having an additional option or promise that gets resolved on completion of animation would be sufficient. However, another option would be to just put the resolve in an $evalAsync block. That way the animation would kick off before parent scopes get destroyed. It would still resolve almost immediately after the close functions are called. |
It looks like $evalAsync does not work - however, $timeout does work, so I will open a PR shortly with this fix. |
+1 disabling the animation as a workaround works as well |
+1 |
1 similar comment
+1 |
I've ran into same scenario with angular 1.4.1. Disabling animation solved my problem too. |
I'm working on a fix now and it should fix this issue. |
- supports Angular 1.4 Fixes angular-ui#3787 Fixes angular-ui#3806 Closes angular-ui#3888
- supports Angular 1.4 Fixes angular-ui#3787 Fixes angular-ui#3806 Fixes angular-ui#3873 Closes angular-ui#3888
Angular version: 1.3.16
ui-bootstrap version: 0.13.0
This is related to, but not the same as #3633 and #3620. If you create a new scope to pass to $modal.open, it needs to be destroyed when the dialog closes to prevent memory leaks. The only event we currently get to perform this action is the result promise. However, this resolves before the closing animation is executed. If you destroy the new scope at that point, the animation cannot execute, because of its dependency on ngClass to remove the 'in' CSS class.
Here is a Plunkr that shows the behavior: http://plnkr.co/edit/yaFvaOGu1NUxkzXwfFuJ?p=preview
This same Plunkr works when using version 0.12.1, so it is a breaking change.
The text was updated successfully, but these errors were encountered: