问题
I'm new to angular and struggling with this. I have several heading elements with a truncate
class applied to them so that they will truncate if their content is longer than one line. I want to show a uib-tooltip with the full content of the heading on mouseenter, but I don't want the tooltip to show if the content has not been truncated. The condition is the easy part, using scrollWidth
and offsetWidth
. I have that part working.
I have tried dynamically applying the uib-tooltip
attribute on mouseenter
if the content is truncated, but this doesn't seem to work. I have also tried using the tooltip-enable
attribute to no avail.
I am now wondering if I'm going about this all wrong, and if there is a much simpler way to achieve this.
来源:https://stackoverflow.com/questions/44297971/show-uib-tooltip-on-mouseenter-only-if-a-condition-is-met