Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal doesn't call ngOnDestroy when closing #806

Closed
natcohen opened this issue Sep 28, 2016 · 6 comments
Closed

Modal doesn't call ngOnDestroy when closing #806

natcohen opened this issue Sep 28, 2016 · 6 comments

Comments

@natcohen
Copy link

When using modal with an external component like this:

<template #addEntity="" let-c="close">
  <add-entity [close]="c"></add-entity>
</template>

ngOnInit is being called but ngOnDestroy is never called (backdrop close or close function...).

@wesleycho
Copy link
Member

This sounds potentially more like an Angular bug than an ng-bootstrap one - @pkozlowski-opensource what do you think? NgbModalRef is removing the modal elements by calling viewContainerRef.remove, this seems like a deficiency in ViewContainerRef.

@pkozlowski-opensource
Copy link
Member

Agree with @wesleycho that it looks like a bug / sth missing in the Angular itself. I will try to reduce the scenario to sth that is not using ngb and report / fix it upstream.

Of course if anyone else has free cycles to provide a simpler reproduce scenario (not involving ng-bootstrap) and report issue upstream - this would be much appreciated!

@pkozlowski-opensource
Copy link
Member

Looked into this one a bit and I can't reproduce this with Angular only: https://plnkr.co/edit/AiqvW2yzAgY7LFXjwMWG?p=preview

At the same time I can clearly reproduce this with ng-bootstrap + modal: http://plnkr.co/edit/i3ajJvZ3bjQyk2I3rDmy?p=preview

Finally it might be an issue on our side and I think that I know what is going on. I need to investigate further to confirm.

@meshubh
Copy link

meshubh commented Mar 1, 2019

Is this issue fixed.

I still face the issue where in I try to close the modal using the .hide() method on the dialogRef but I still see the ngOnDestroy not being called.

bootstrap: 3.0.1
angular: 7.2.2

@deepabalasundaram
Copy link

I see the same issue as well.

bootstrap: 4.1.3
angular: 8.0.1

@vasnakos
Copy link

Any news?
I have the same issue with:

bootstrap: 5.2.3
angular: 15.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants