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

docs$rootScope.Scope#$watchGroup: clarify listener's oldValues parameter #12643

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
5 changes: 3 additions & 2 deletions src/ng/rootScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,9 @@ function $RootScopeProvider() {
* expression in `watchExpressions` changes
* The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching
* those of `watchExpression`
* and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching
* those of `watchExpression`
* and the `oldValues` array contains the value of each `watchExpression` before the last change (it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is clear enough. My head actually hurts a bit reading it. I will also see if I can come up with a better wording.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it is not perfect. It is pretty tricky to describe this behavior concisely and clearly. New attempt:

and the oldValues array contains the value of each watchExpression before it was last changed (even if that change did not happen in this digest cycle).

Happy for any suggestion with regards to wording - as long as we mention this for me unexpected behavior explicitly. If you can tell which part exactly find hard to understand, I will try to improve that specifically.

* will contain an older value if this `watchExpression` has not changed since `listener` was last
* called). The indexes match those of `watchExpression`.
* The `scope` refers to the current scope.
* @returns {function()} Returns a de-registration function for all listeners.
*/
Expand Down