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

Commit

Permalink
feat(tooltip): update position dynamically
Browse files Browse the repository at this point in the history
Reposition on each digest, this ensures that the tooltip is always positioned
correctly no matter how its content changes.

Fixes #96
Fixes #1109
Closes #2816
  • Loading branch information
chrisirhc committed Mar 25, 2015
1 parent 9468d72 commit c8cde43
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
var ttScope = scope.$new(true);

var positionTooltip = function () {
if (!tooltip) { return; }

var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody);
ttPosition.top += 'px';
Expand Down Expand Up @@ -237,6 +238,10 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
element.after( tooltip );
}
});

tooltipLinkedScope.$watch(function () {
$timeout(positionTooltip, 0, false);
});
}

function removeTooltip() {
Expand Down

0 comments on commit c8cde43

Please sign in to comment.