diff --git a/safe-apply.js b/safe-apply.js index 0db7df9..2c12253 100644 --- a/safe-apply.js +++ b/safe-apply.js @@ -53,7 +53,8 @@ fn = fn || function () {}; - if (force || !($scope.$$phase || $scope.$root.$$phase)) { + if (force || !($scope.$$phase || + ($scope.$root && $scope.$root.$$phase))) { $scope.$apply ? $scope.$apply(fn) : $scope.apply(fn); } else { fn();