Skip to content

Commit 33d7343

Browse files
committed
fix(tooltip): incorrect position when text wraps
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.
1 parent eec68d8 commit 33d7343

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/tooltip/tooltip.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
189189

190190
// Set the initial positioning.
191191
tooltip.css({ top: 0, left: 0, display: 'block' });
192-
193-
// Now we add it to the DOM because need some info about it. But it's not
194-
// visible yet anyway.
195-
if ( appendToBody ) {
196-
$document.find( 'body' ).append( tooltip );
197-
} else {
198-
element.after( tooltip );
199-
}
192+
ttScope.$digest();
200193

201194
positionTooltip();
202195

@@ -236,7 +229,13 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
236229
removeTooltip();
237230
}
238231
tooltipLinkedScope = ttScope.$new();
239-
tooltip = tooltipLinker(tooltipLinkedScope, angular.noop);
232+
tooltip = tooltipLinker(tooltipLinkedScope, function (tooltip) {
233+
if ( appendToBody ) {
234+
$document.find( 'body' ).append( tooltip );
235+
} else {
236+
element.after( tooltip );
237+
}
238+
});
240239
}
241240

242241
function removeTooltip() {

0 commit comments

Comments
 (0)