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

Commit

Permalink
fix(typeahead): add guard for destroyed $scope
Browse files Browse the repository at this point in the history
- Add guard against accessing $scope when it has been destroyed

Closes #5267
  • Loading branch information
kwiateusz authored and wesleycho committed Jan 16, 2016
1 parent f19b657 commit e105e85
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,20 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s

// First things first: we don't show it anymore.
ttScope.$evalAsync(function() {
ttScope.isOpen = false;
assignIsOpen(false);
// And now we remove it from the DOM. However, if we have animation, we
// need to wait for it to expire beforehand.
// FIXME: this is a placeholder for a port of the transitions library.
// The fade transition in TWBS is 150ms.
if (ttScope.animation) {
if (!transitionTimeout) {
transitionTimeout = $timeout(removeTooltip, 150, false);
if(ttScope){
ttScope.isOpen = false;
assignIsOpen(false);
// And now we remove it from the DOM. However, if we have animation, we
// need to wait for it to expire beforehand.
// FIXME: this is a placeholder for a port of the transitions library.
// The fade transition in TWBS is 150ms.
if (ttScope.animation) {
if (!transitionTimeout) {
transitionTimeout = $timeout(removeTooltip, 150, false);
}
} else {
removeTooltip();
}
} else {
removeTooltip();
}
});
}
Expand Down

0 comments on commit e105e85

Please sign in to comment.