Topic: A tooltip fails after replacing its trigger with a conditional button

waveFormDev pro asked 6 days ago


Our toolbar swaps an Edit button for a Save button while a record is being edited. Both have tooltip text, but after the first toggle the newly displayed button sometimes has no tooltip. The original button worked when the screen first loaded.

The buttons are created by separate conditional branches, and a parent component caches an element reference during its initial view setup. Should the tooltip be attached to the conditional button itself, or should we refresh that cached reference after every toggle?



A conditional branch can destroy its button and create a different element. A cached reference to the first button does not follow that replacement. Prefer declaring the tooltip on each button in the template so its lifecycle follows its own trigger.

Remove the parallel manual initialization while testing that setup. If you must manage the element yourself, react to the changing view query and dispose of the previous instance before attaching another one. Please share the two conditional branches and the initialization code if the declarative setup still fails.

https://mdbootstrap.com/docs/angular/components/tooltips/



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: MDB5 9.1.0
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows 11
  • Provided sample code: No
  • Provided link: No