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

fix(tooltip): tooltip w/ template position #4144

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
var triggers = getTriggers( undefined );
var hasEnableExp = angular.isDefined(attrs[prefix+'Enable']);
var ttScope = scope.$new(true);
var repositionScheduled = false;

var positionTooltip = function () {
if (!tooltip) { return; }
Expand Down Expand Up @@ -254,11 +255,21 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap

if (options.useContentExp) {
tooltipLinkedScope.$watch('contentExp()', function (val) {
positionTooltipAsync();
if (!val && ttScope.isOpen ) {
if (!val && ttScope.isOpen) {
hide();
}
});

tooltipLinkedScope.$watch(function() {
if (!repositionScheduled) {
repositionScheduled = true;
tooltipLinkedScope.$$postDigest(function() {
repositionScheduled = false;
positionTooltipAsync();
});
}
});

}
}

Expand Down Expand Up @@ -290,10 +301,11 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
if (!options.useContentExp) {
attrs.$observe( type, function ( val ) {
ttScope.content = val;
positionTooltipAsync();

if (!val && ttScope.isOpen ) {
if (!val && ttScope.isOpen) {
hide();
} else {
positionTooltipAsync();
}
});
}
Expand Down