From 1a99ca9c08511ebc526c57f7cc945f78b0685148 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 26 Jun 2014 01:21:44 -0400 Subject: [PATCH] docs($q): remove unnecessary $scope.apply wrapping As of Angular 1.2, this kind of thing is no longer necessary (thank goodness!) --- src/ng/q.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/ng/q.js b/src/ng/q.js index 4ac55423e..a07da6ffe 100644 --- a/src/ng/q.js +++ b/src/ng/q.js @@ -23,17 +23,13 @@ * var deferred = $q.defer(); * * setTimeout(function() { - * // since this fn executes async in a future turn of the event loop, we need to wrap - * // our code into an $apply call so that the model changes are properly observed. - * scope.$apply(function() { - * deferred.notify('About to greet ' + name + '.'); + * deferred.notify('About to greet ' + name + '.'); * - * if (okToGreet(name)) { - * deferred.resolve('Hello, ' + name + '!'); - * } else { - * deferred.reject('Greeting ' + name + ' is not allowed.'); - * } - * }); + * if (okToGreet(name)) { + * deferred.resolve('Hello, ' + name + '!'); + * } else { + * deferred.reject('Greeting ' + name + ' is not allowed.'); + * } * }, 1000); * * return deferred.promise;