From 240e8de40942fd5b8589315c957051611d2b96eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20M=C3=BCller?= Date: Thu, 3 Mar 2016 21:39:29 +0100 Subject: [PATCH] Fix for issue #2 --- safe-apply.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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();