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

Commit cbc2024

Browse files
mbrownemhevery
authored andcommitted
docs(rootScope): correct code examples
1 parent f0ff702 commit cbc2024

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ng/rootScope.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function $RootScopeProvider(){
9191
expect(scope.greeting).toEqual(undefined);
9292
9393
scope.$watch('name', function() {
94-
this.greeting = this.salutation + ' ' + this.name + '!';
94+
scope.greeting = scope.salutation + ' ' + scope.name + '!';
9595
}); // initialize the watch
9696
9797
expect(scope.greeting).toEqual(undefined);
@@ -253,7 +253,7 @@ function $RootScopeProvider(){
253253
scope.counter = 0;
254254
255255
expect(scope.counter).toEqual(0);
256-
scope.$watch('name', function(newValue, oldValue) { counter = counter + 1; });
256+
scope.$watch('name', function(newValue, oldValue) { scope.counter = scope.counter + 1; });
257257
expect(scope.counter).toEqual(0);
258258
259259
scope.$digest();
@@ -346,7 +346,7 @@ function $RootScopeProvider(){
346346
347347
expect(scope.counter).toEqual(0);
348348
scope.$watch('name', function(newValue, oldValue) {
349-
counter = counter + 1;
349+
scope.counter = scope.counter + 1;
350350
});
351351
expect(scope.counter).toEqual(0);
352352

0 commit comments

Comments
 (0)