bug(md-tooltip): tooltip is not removed when parent is
Consider a scenario where there's a button inside a container. The button has a tooltip and on click it should set a variable to another value. Based on that value the container element is added / removed with ngIf. Simple example:
<div *ngIf="!hidden">
<button
md-button
md-tooltip="Hide this button"
tooltip-position="after"
(click)="hidden = true">HIDE ME!</button>
</div>
After clicking the button the container div is removed, however, the tooltip remains still, no way to remove it.
hello any workarounds ?
It's a bit hacky, but what I'm doing now is adding
MdTooltip.prototype.ngOnDestroy = function () {
this._overlayRef.dispose();
this._overlayRef = null;
};
to node_modules/@angular2-material/tooltip/tooltip.js (just put it after the ngOnInit prototype).
@ivoviz 's hack still works in alpha.9, after the changes of the module structure.
However, now need to edit the ~/node_modules/@angular/material/material.umd.js.
@jelbourn , Just wanted to know any plan to fix this issue soon?
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.