Class: FyzTooltipService
@flyze/lib-core-angular 1.0.0-alpha.34· latestDefined in: projects/lib-core-angular/src/lib/directives/fyz-tooltip/fyz-tooltip.service.ts:61
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FyzTooltipService(
overlay,positionBuilder,injector,zone):FyzTooltipService
Defined in: projects/lib-core-angular/src/lib/directives/fyz-tooltip/fyz-tooltip.service.ts:70
Parameters
Section titled “Parameters”overlay
Section titled “overlay”Overlay
positionBuilder
Section titled “positionBuilder”OverlayPositionBuilder
injector
Section titled “injector”Injector
NgZone
Returns
Section titled “Returns”FyzTooltipService
Methods
Section titled “Methods”attach()
Section titled “attach()”attach(
hostOrRef,optionsOrFactory): () =>void
Defined in: projects/lib-core-angular/src/lib/directives/fyz-tooltip/fyz-tooltip.service.ts:271
Wire hover behaviour onto a host and get back the teardown for it.
This is the method to reach for. show() and hide() are the primitives underneath, and a
consumer wiring them up by hand writes the same forty lines every time - two listeners, an
empty-text guard, and a teardown that has to remember to remove the listeners and dispose a
panel that may still be on screen. Forgetting the last part is the regression in commit
0dd3d62e, “tooltip was stuck if the button is destroyed”.
Pass a factory rather than a fixed object whenever the text or the delays depend on state that
changes after this call: it is re-read on every hover, so there is nothing to keep in sync and no
listener to re-register when the answer changes. Returning nullish, or options whose text is
empty, suppresses that hover.
Parameters
Section titled “Parameters”hostOrRef
Section titled “hostOrRef”optionsOrFactory
Section titled “optionsOrFactory”FyzTooltipOptions | FyzTooltipOptionsFactory
Returns
Section titled “Returns”An idempotent stop function. Call it from ngOnDestroy; calling it twice is safe.
() => void
hide()
Section titled “hide()”hide(
hostOrRef,hideDelay?):void
Defined in: projects/lib-core-angular/src/lib/directives/fyz-tooltip/fyz-tooltip.service.ts:188
Hide the tooltip on a given host element, running the exit animation.
Parameters
Section titled “Parameters”hostOrRef
Section titled “hostOrRef”hideDelay?
Section titled “hideDelay?”number
Milliseconds to wait before starting the exit animation. Omit to use the
hideDelay the panel was shown with, which is the usual case - the caller hiding a tooltip is
rarely the one that configured it. Pass a number to override it for this call only; pass 0
for no delay.
Returns
Section titled “Returns”void
hideAll()
Section titled “hideAll()”hideAll():
void
Defined in: projects/lib-core-angular/src/lib/directives/fyz-tooltip/fyz-tooltip.service.ts:232
Hide every open tooltip, running each exit animation but honouring no delay.
The escape hatch for a consumer that lost track of its anchors - a route change, say - so it
overrides the configured hideDelay: waiting a second and a half per panel while the page has
already moved on is not what any caller of this wants.
Returns
Section titled “Returns”void
hideImmediately()
Section titled “hideImmediately()”hideImmediately(
hostOrRef):void
Defined in: projects/lib-core-angular/src/lib/directives/fyz-tooltip/fyz-tooltip.service.ts:215
Remove the tooltip on a given host element at once, with no exit animation and no delay.
For teardown paths. hide() is the wrong call there once a hideDelay is in play: it would
leave the panel on screen for the length of the delay after its anchor is already gone.
Parameters
Section titled “Parameters”hostOrRef
Section titled “hostOrRef”Returns
Section titled “Returns”void
isOpen()
Section titled “isOpen()”isOpen(
hostOrRef):boolean
Defined in: projects/lib-core-angular/src/lib/directives/fyz-tooltip/fyz-tooltip.service.ts:251
Whether a panel exists for this host.
The query a consumer holding nothing but an HTMLElement has no other way to answer, and the
reason it is here: without it, anything driving show()/hide() from its own events has to keep
a parallel boolean in sync with this service by hand, and gets it wrong the first time a panel
closes by any route it did not initiate - hideAll(), a teardown, a pointer leaving the host.
True from the moment show() attaches an overlay, so it covers a panel that is still inside its
showDelay and not on screen yet. That is deliberate: the caller asking is deciding whether to
open or close, and a pending panel must count as open or it opens a second one. Distinct from the
panel’s own isVisible, which only flips when the entry animation starts.
Parameters
Section titled “Parameters”hostOrRef
Section titled “hostOrRef”Returns
Section titled “Returns”boolean
show()
Section titled “show()”show(
hostOrRef,options):void
Defined in: projects/lib-core-angular/src/lib/directives/fyz-tooltip/fyz-tooltip.service.ts:77
Parameters
Section titled “Parameters”hostOrRef
Section titled “hostOrRef”options
Section titled “options”Returns
Section titled “Returns”void
update()
Section titled “update()”update(
hostOrRef,options):void
Defined in: projects/lib-core-angular/src/lib/directives/fyz-tooltip/fyz-tooltip.service.ts:319
Update a tooltip that is already on screen, in place.
A no-op when nothing is open for that host - so a caller reacting to a change of state does not have to know whether the tooltip happens to be up.
Parameters
Section titled “Parameters”hostOrRef
Section titled “hostOrRef”options
Section titled “options”Partial<FyzTooltipOptions>
Returns
Section titled “Returns”void