-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Tooltip: this._unregisterListenersFn is not a function #2199
Comments
@bygrace1986 here is a minimal plunker that confirms my initial thinking: http://plnkr.co/edit/wTdALkovBrdIFJBHoIpk?p=preview Please notice that calling So, it looks like creating and immediately destroying a view can result in a situation where Given all this the real question is: is it a valid use-case? I can see how you got into this situation in your implementation, but I would argue that this implementation us sub-optimal. Here is why:
If you fix 2 above problems in a different implementation of your acl directive you would have more robust implementation and you wouldn't run into issues with tooltips, see: https://stackblitz.com/edit/acl-directive-dpvcsx?file=app%2Facl.directive.ts I believe that the implementation I'm proposing is simpler, more performant and correct. You see problems with tooltips since you are creating and destroying views for nothing. I will probably add a guard to tooltip's |
@pkozlowski-opensource Agreed, I realized that it wasn't optimal to create an destroy it so quickly but it illustrated the point so I left it alone. I've seen it come up with weird routing scenarios too and apparently someone found a way to do it with Thanks for taking the time to look into the issue and the feedback! |
I also have seen routing causing this issue. IIRC it was happening when redirect is triggered from the component constructor. So change detection run was creating components, and than redirect happened in one of them and it started destroying components before it got to calling Happy that it is being fixed! -1 workaround in my project 😄 |
Bug description:
If an element with the tooltip directive on it is quickly created and destroyed by a structural directive then it causes the following error:
_unregisterListenersFn
is initialized inngOnInit
so it appears that it is not being invoked beforengOnDestroy
.Link to minimally-working plunker that reproduces the issue:
https://stackblitz.com/edit/acl-directive
Version of Angular, ng-bootstrap, and Bootstrap:
Angular: 5.0.0
ng-bootstrap: 1.0.0
Bootstrap: N/A
The text was updated successfully, but these errors were encountered: