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

Commit

Permalink
fix(tooltip): correctly handle initial events unbinding
Browse files Browse the repository at this point in the history
Closes #750
  • Loading branch information
pkozlowski-opensource committed Aug 3, 2013
1 parent 58e8ef4 commit 4fd5bf4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] )
var $body;
var appendToBody = angular.isDefined( options.appendToBody ) ? options.appendToBody : false;
var triggers = setTriggers( undefined );
var hasRegisteredTriggers = false;

// By default, the tooltip is not open.
// TODO add ability to start tooltip opened
Expand Down Expand Up @@ -276,8 +277,11 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] )
});

attrs.$observe( prefix+'Trigger', function ( val ) {
element.unbind( triggers.show, showTooltipBind );
element.unbind( triggers.hide, hideTooltipBind );

if (hasRegisteredTriggers) {
element.unbind( triggers.show, showTooltipBind );
element.unbind( triggers.hide, hideTooltipBind );
}

triggers = setTriggers( val );

Expand All @@ -287,6 +291,8 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] )
element.bind( triggers.show, showTooltipBind );
element.bind( triggers.hide, hideTooltipBind );
}

hasRegisteredTriggers = true;
});

attrs.$observe( prefix+'AppendToBody', function ( val ) {
Expand Down

0 comments on commit 4fd5bf4

Please sign in to comment.