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

Commit bd395ac

Browse files
committed
refactor(tooltip): use watcher for animation attr
This removes the need to convert the attribute value string back into a boolean.
1 parent 41eea51 commit bd395ac

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/tooltip/tooltip.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,16 +261,19 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
261261
scope.tt_placement = angular.isDefined( val ) ? val : options.placement;
262262
});
263263

264-
attrs.$observe(prefix + 'Animation', function (val) {
265-
var shouldAnimate = val !== 'false';
266-
scope.tt_animation = angular.isDefined(val) ? shouldAnimate : options.animation;
267-
});
268-
269264
attrs.$observe( prefix+'PopupDelay', function ( val ) {
270265
var delay = parseInt( val, 10 );
271266
scope.tt_popupDelay = ! isNaN(delay) ? delay : options.popupDelay;
272267
});
273268

269+
if (attrs[prefix + 'Animation']) {
270+
scope.$watch(attrs[prefix + 'Animation'], function (val) {
271+
scope.tt_animation = angular.isDefined(val) ? !!val : options.animation;
272+
});
273+
} else {
274+
scope.tt_animation = options.animation;
275+
}
276+
274277
var unregisterTriggers = function() {
275278
if (hasRegisteredTriggers) {
276279
element.unbind( triggers.show, showTooltipBind );

0 commit comments

Comments
 (0)