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

Commit 4fd5bf4

Browse files
committedAug 3, 2013
fix(tooltip): correctly handle initial events unbinding
Closes #750
1 parent 58e8ef4 commit 4fd5bf4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/tooltip/tooltip.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] )
122122
var $body;
123123
var appendToBody = angular.isDefined( options.appendToBody ) ? options.appendToBody : false;
124124
var triggers = setTriggers( undefined );
125+
var hasRegisteredTriggers = false;
125126

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

278279
attrs.$observe( prefix+'Trigger', function ( val ) {
279-
element.unbind( triggers.show, showTooltipBind );
280-
element.unbind( triggers.hide, hideTooltipBind );
280+
281+
if (hasRegisteredTriggers) {
282+
element.unbind( triggers.show, showTooltipBind );
283+
element.unbind( triggers.hide, hideTooltipBind );
284+
}
281285

282286
triggers = setTriggers( val );
283287

@@ -287,6 +291,8 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] )
287291
element.bind( triggers.show, showTooltipBind );
288292
element.bind( triggers.hide, hideTooltipBind );
289293
}
294+
295+
hasRegisteredTriggers = true;
290296
});
291297

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

0 commit comments

Comments
 (0)