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

docs($rootScope): fix incorrect docs and make them clearer #7598

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/ng/rootScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,17 @@ function $RootScopeProvider(){
expect(scope.counter).toEqual(0);

scope.$digest();
// no variable change
expect(scope.counter).toEqual(0);
// the listener is always called during the first $digest loop after it was registered
expect(scope.counter).toEqual(1);

scope.name = 'adam';
scope.$digest();
// but now it will not be called unless the value changes
expect(scope.counter).toEqual(1);

scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(2);



// Using a listener function
Expand Down Expand Up @@ -632,12 +636,16 @@ function $RootScopeProvider(){
expect(scope.counter).toEqual(0);

scope.$digest();
// no variable change
expect(scope.counter).toEqual(0);
// the listener is always called during the first $digest loop after it was registered
expect(scope.counter).toEqual(1);

scope.name = 'adam';
scope.$digest();
// but now it will not be called unless the value changes
expect(scope.counter).toEqual(1);

scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(2);
* ```
*
*/
Expand Down