Skip to content

Commit

Permalink
fix(tooltip): incorrect position when text wraps
Browse files Browse the repository at this point in the history
The $digest that was removed in 32c470 is actually necessary to get the
tooltip contents rendered. The rendered content is important when the
tooltip is on the right edge. See Plunker in angular-ui#2995:
http://plnkr.co/edit/8GZ5F5zj3Xe6IinXQz74?p=preview

Fixes angular-ui#2995

Correctly fixes angular-ui#2951 without removing $digest.
  • Loading branch information
chrisirhc committed Nov 19, 2014
1 parent eec68d8 commit 33d7343
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap

// Set the initial positioning.
tooltip.css({ top: 0, left: 0, display: 'block' });

// Now we add it to the DOM because need some info about it. But it's not
// visible yet anyway.
if ( appendToBody ) {
$document.find( 'body' ).append( tooltip );
} else {
element.after( tooltip );
}
ttScope.$digest();

positionTooltip();

Expand Down Expand Up @@ -236,7 +229,13 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
removeTooltip();
}
tooltipLinkedScope = ttScope.$new();
tooltip = tooltipLinker(tooltipLinkedScope, angular.noop);
tooltip = tooltipLinker(tooltipLinkedScope, function (tooltip) {
if ( appendToBody ) {
$document.find( 'body' ).append( tooltip );
} else {
element.after( tooltip );
}
});
}

function removeTooltip() {
Expand Down

0 comments on commit 33d7343

Please sign in to comment.