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

Commit 22b16f0

Browse files
committed
fix(tooltip): add safety to $apply
- Change to use `$rootScope.$digest()` only as necessary for safety Closes #3943 Closes #4150 Fixes #516
1 parent 895a228 commit 22b16f0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/tooltip/tooltip.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
6565
* Returns the actual instance of the $tooltip service.
6666
* TODO support multiple triggers
6767
*/
68-
this.$get = [ '$window', '$compile', '$timeout', '$document', '$position', '$interpolate', function ( $window, $compile, $timeout, $document, $position, $interpolate ) {
68+
this.$get = [ '$window', '$compile', '$timeout', '$document', '$position', '$interpolate', '$rootScope', function ( $window, $compile, $timeout, $document, $position, $interpolate, $rootScope ) {
6969
return function $tooltip ( type, prefix, defaultTriggerShow, options ) {
7070
options = angular.extend( {}, defaultOptions, globalOptions, options );
7171

@@ -179,9 +179,10 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
179179
}
180180

181181
function hideTooltipBind () {
182-
scope.$apply(function () {
183-
hide();
184-
});
182+
hide();
183+
if (!$rootScope.$$phase) {
184+
$rootScope.$digest();
185+
}
185186
}
186187

187188
// Show the tooltip popup element.

0 commit comments

Comments
 (0)