Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 99fb74f

Browse files
committed
feat(tooltip): update position dynamically
Reposition on each digest, this ensures that the tooltip is always positioned correctly no matter how its content changes.
1 parent 4d10751 commit 99fb74f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: src/tooltip/tooltip.js

+5
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
121121
var ttScope = scope.$new(true);
122122

123123
var positionTooltip = function () {
124+
if (!tooltip) { return; }
124125

125126
var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody);
126127
ttPosition.top += 'px';
@@ -239,6 +240,10 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
239240
element.after( tooltip );
240241
}
241242
});
243+
244+
tooltipLinkedScope.$watch(function () {
245+
$timeout(positionTooltip, 0, false);
246+
});
242247
}
243248

244249
function removeTooltip() {

0 commit comments

Comments
 (0)