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

Commit e10d561

Browse files
committed
fix(tooltip): evaluate appendToBody on init
This wasn't working properly with the location change code (lines 305-314) because the observe call happens asynchronously after the linking function has completed. Hence, the locationChangeSuccess wasn't being set up unless the global tooltip option's appendToBody option was set to true. Closes #2921
1 parent 5df524b commit e10d561

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/tooltip/tooltip.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
6464
* Returns the actual instance of the $tooltip service.
6565
* TODO support multiple triggers
6666
*/
67-
this.$get = [ '$window', '$compile', '$timeout', '$parse', '$document', '$position', '$interpolate', function ( $window, $compile, $timeout, $parse, $document, $position, $interpolate ) {
67+
this.$get = [ '$window', '$compile', '$timeout', '$document', '$position', '$interpolate', function ( $window, $compile, $timeout, $document, $position, $interpolate ) {
6868
return function $tooltip ( type, prefix, defaultTriggerShow ) {
6969
var options = angular.extend( {}, defaultOptions, globalOptions );
7070

@@ -299,9 +299,8 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
299299
var animation = scope.$eval(attrs[prefix + 'Animation']);
300300
scope.tt_animation = angular.isDefined(animation) ? !!animation : options.animation;
301301

302-
attrs.$observe( prefix+'AppendToBody', function ( val ) {
303-
appendToBody = angular.isDefined( val ) ? $parse( val )( scope ) : appendToBody;
304-
});
302+
var appendToBodyVal = scope.$eval(attrs[prefix + 'AppendToBody']);
303+
appendToBody = angular.isDefined(appendToBodyVal) ? appendToBodyVal : appendToBody;
305304

306305
// if a tooltip is attached to <body> we need to remove it on
307306
// location change as its parent scope will probably not be destroyed

0 commit comments

Comments
 (0)