ngSemantic icon indicating copy to clipboard operation
ngSemantic copied to clipboard

Tooltip does not update

Open flemeur opened this issue 8 years ago • 3 comments

A tooltip does not update when the directive's smDirTooltip attribute changes.

Perhaps the directive could use ngOnChanges to update the data-tooltip attribute?

flemeur avatar Nov 21 '16 14:11 flemeur

For anyone experiencing the same problem: I found a solution by using attr.data-tooltip="" instead. This works when the tooltip needs to reflect dynamic changes

flemeur avatar Nov 22 '16 08:11 flemeur

@flemeur I believe your solution would defeat the purpose of the directive itself, if you set the data properties directly.

I would image that having the smDirTooltip and smDirPosition as setters instead of class properties would be a good solution to this problem. For instance:

@Input()
set smDirTooltip(toolTip: string) {
    this.element.element.nativeElement.setAttribute("data-tooltip", toolTip);
}

@Input()
set smDirPosition(position: string) {
    this.element.element.nativeElement.setAttribute("data-position", position);
}

And you could have some extra logic for defaults much like is already in the code. Just a suggestion.

tspayne87 avatar Dec 05 '16 06:12 tspayne87

@tspayne87 That would definitely be a good solution. I only mentioned my temporary "solution" because others might find it useful, until a proper fix is implemented :)

flemeur avatar Dec 05 '16 16:12 flemeur