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

Add tooltipDisabled convenience property #3

Open
sparerd opened this issue Nov 13, 2019 · 0 comments
Open

Add tooltipDisabled convenience property #3

sparerd opened this issue Nov 13, 2019 · 0 comments

Comments

@sparerd
Copy link

sparerd commented Nov 13, 2019

There are times when we want to disable a tooltip based on computed properties or states of elements in the component.

Current

Currently, our options seem to be disabling the tooltip programmatically via a ViewChild reference, setting tooltipTrigger to manual, or setting the tooltip content to nothing. These are ok, but it's unfortunately there isn't a simpler way to handle this.

Desired

I would like to be able to set a property on an HTML element that would prevent a given tooltip from displaying.

<!-- component.html -->
<button ngxTooltip
        tooltipContent="Conditional tooltip text"
        [tooltipDisabled]="someComputedProperty"></button>
// component.ts
...
public get someComputedProperty(): boolean {
    return this.someFlag1 && this.someFlag2;
}
...

This would also simplify conditionals based on template refs (contrived example):

<!-- component.html -->
<input #myInput type="text" />
<button ngxTooltip
        tooltipContent="The input doesn't have any text!"
        [tooltipDisabled]="!myInput.value">Send</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant