By using data-original-title the tooltips live update without reapplying the
js code, such as .tooltip('fixTitle') each time the content changes. This
method also works well with angular expressions:
data-original-title="{{'Download Rate' | translate}}"
This example provides a bootstrap tooltip saying 'Download Rate' that changes
automatically when the language is updated.
12 lines
294 B
JavaScript
12 lines
294 B
JavaScript
angular.module('syncthing.core')
|
|
.directive('tooltip', function () {
|
|
return {
|
|
restrict: 'A',
|
|
link: function (scope, element, attributes) {
|
|
$(element).tooltip({
|
|
html: 'true'
|
|
});
|
|
}
|
|
};
|
|
});
|