Skip to content

Commit c8cde43

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. Fixes angular-ui#96 Fixes angular-ui#1109 Closes angular-ui#2816
1 parent 9468d72 commit c8cde43

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
@@ -122,6 +122,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
122122
var ttScope = scope.$new(true);
123123

124124
var positionTooltip = function () {
125+
if (!tooltip) { return; }
125126

126127
var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody);
127128
ttPosition.top += 'px';
@@ -237,6 +238,10 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
237238
element.after( tooltip );
238239
}
239240
});
241+
242+
tooltipLinkedScope.$watch(function () {
243+
$timeout(positionTooltip, 0, false);
244+
});
240245
}
241246

242247
function removeTooltip() {

0 commit comments

Comments
 (0)