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.
  • Loading branch information
chrisirhc committed Mar 17, 2015
1 parent 4d10751 commit 99fb74f
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 @@ -121,6 +121,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 @@ -239,6 +240,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 99fb74f

Please sign in to comment.