Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit e970df8

Browse files
domenicbtford
authored andcommitted
docs($q): remove unnecessary $scope.apply wrapping
As of Angular 1.2, this kind of thing is no longer necessary (thank goodness!)
1 parent a1c19c4 commit e970df8

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/ng/q.js

+7-11
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@
2323
* var deferred = $q.defer();
2424
*
2525
* setTimeout(function() {
26-
* // since this fn executes async in a future turn of the event loop, we need to wrap
27-
* // our code into an $apply call so that the model changes are properly observed.
28-
* scope.$apply(function() {
29-
* deferred.notify('About to greet ' + name + '.');
30-
*
31-
* if (okToGreet(name)) {
32-
* deferred.resolve('Hello, ' + name + '!');
33-
* } else {
34-
* deferred.reject('Greeting ' + name + ' is not allowed.');
35-
* }
36-
* });
26+
* deferred.notify('About to greet ' + name + '.');
27+
*
28+
* if (okToGreet(name)) {
29+
* deferred.resolve('Hello, ' + name + '!');
30+
* } else {
31+
* deferred.reject('Greeting ' + name + ' is not allowed.');
32+
* }
3733
* }, 1000);
3834
*
3935
* return deferred.promise;

0 commit comments

Comments
 (0)