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

Commit e105e85

Browse files
kwiateuszwesleycho
authored andcommitted
fix(typeahead): add guard for destroyed $scope
- Add guard against accessing $scope when it has been destroyed Closes #5267
1 parent f19b657 commit e105e85

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/tooltip/tooltip.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -287,18 +287,20 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
287287

288288
// First things first: we don't show it anymore.
289289
ttScope.$evalAsync(function() {
290-
ttScope.isOpen = false;
291-
assignIsOpen(false);
292-
// And now we remove it from the DOM. However, if we have animation, we
293-
// need to wait for it to expire beforehand.
294-
// FIXME: this is a placeholder for a port of the transitions library.
295-
// The fade transition in TWBS is 150ms.
296-
if (ttScope.animation) {
297-
if (!transitionTimeout) {
298-
transitionTimeout = $timeout(removeTooltip, 150, false);
290+
if(ttScope){
291+
ttScope.isOpen = false;
292+
assignIsOpen(false);
293+
// And now we remove it from the DOM. However, if we have animation, we
294+
// need to wait for it to expire beforehand.
295+
// FIXME: this is a placeholder for a port of the transitions library.
296+
// The fade transition in TWBS is 150ms.
297+
if (ttScope.animation) {
298+
if (!transitionTimeout) {
299+
transitionTimeout = $timeout(removeTooltip, 150, false);
300+
}
301+
} else {
302+
removeTooltip();
299303
}
300-
} else {
301-
removeTooltip();
302304
}
303305
});
304306
}

0 commit comments

Comments
 (0)