mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-05 17:01:19 +08:00
docs(rootScope): correct code examples
This commit is contained in:
committed by
Misko Hevery
parent
f0ff7023c3
commit
cbc2024092
@@ -91,7 +91,7 @@ function $RootScopeProvider(){
|
||||
expect(scope.greeting).toEqual(undefined);
|
||||
|
||||
scope.$watch('name', function() {
|
||||
this.greeting = this.salutation + ' ' + this.name + '!';
|
||||
scope.greeting = scope.salutation + ' ' + scope.name + '!';
|
||||
}); // initialize the watch
|
||||
|
||||
expect(scope.greeting).toEqual(undefined);
|
||||
@@ -253,7 +253,7 @@ function $RootScopeProvider(){
|
||||
scope.counter = 0;
|
||||
|
||||
expect(scope.counter).toEqual(0);
|
||||
scope.$watch('name', function(newValue, oldValue) { counter = counter + 1; });
|
||||
scope.$watch('name', function(newValue, oldValue) { scope.counter = scope.counter + 1; });
|
||||
expect(scope.counter).toEqual(0);
|
||||
|
||||
scope.$digest();
|
||||
@@ -346,7 +346,7 @@ function $RootScopeProvider(){
|
||||
|
||||
expect(scope.counter).toEqual(0);
|
||||
scope.$watch('name', function(newValue, oldValue) {
|
||||
counter = counter + 1;
|
||||
scope.counter = scope.counter + 1;
|
||||
});
|
||||
expect(scope.counter).toEqual(0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user