kefeizhou
kefeizhou

Reputation: 6552

Adding Angular Bootstrap Tooltip dynamically

Is there any way to add Angular Tooltips dynamically from within the controller? I tried setting the attributes from the controller which does not work.

$("#test").attr("bs-tooltip", "content");

Upvotes: 1

Views: 1856

Answers (2)

JBCP
JBCP

Reputation: 13475

Angular-Strap won't show the tooltip if the text is "", so if you know you will need or might want a tooltip, you could start with the text being "" and dynamically change it.

Alternatively, the documentation claims:

Both $scope.show() and $scope.hide() are available inside the tooltip to toggle its visibility.

Although its not clear to me how to use this functionality.

Upvotes: 0

Andyrooger
Andyrooger

Reputation: 6746

Does it need to be an angular-strap tooltip, or can you just use bootstrap itself? Something like

$("#test").tooltip({
    title: 'content',
    trigger: 'hover',
    // ...
});

Upvotes: 4

Related Questions