Sunday, April 9, 2017

data-tooltip

I've seen some stuff in Googling that suggests that data-tooltip is a pretty good thing to use for a tooltip. You'd use it as a data attribute at a tag. You're still gonna have to roll some CSS magic to make it do anything however. In Angular 2 you may have something like this:

<span [attr.data-tooltip]="whatever.tooltip">{{whatever.title}}</span>

 
 

...and Angular 2 will be smart enough to just not add the attribute if whatever.tooltip is falsey. Also, the alt/title thing will work with attr.alt or attr.title in Angular 2 in the same manner and that trick requires no CSS.

No comments:

Post a Comment