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

docs($location): confusing terminology (observers) #7497

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: 2 additions & 3 deletions docs/content/guide/$location.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,9 @@ use a lower level API, {@link ng.$window $window.location.href}.
## Using $location outside of the scope life-cycle

`$location` knows about Angular's {@link ng.$rootScope.Scope scope} life-cycle. When a URL changes in
the browser it updates the `$location` and calls `$apply` so that all $watchers / $observers are
notified.
the browser it updates the `$location` and calls `$apply` so that all watchers are notified.
When you change the `$location` inside the `$digest` phase everything is ok; `$location` will
propagate this change into browser and will notify all the $watchers / $observers.
propagate this change into browser and will notify all the watchers.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be better to just link to the Scope / Attributes methods instead, to mitigate the confusion? I think links are good.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, this has been fixed a bit differently in d8c5586 --- but the PR is appreciated, please help us make the docs even clearer, there is a lot more of that left to do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do we need to mention the $observe method here in the first place? Watchers are used for a lot of different things. And $observe is just one of them. If we are talking about the scope life-cycle and watchers in general, why mention this specific use case? That was my point.

Also, you've kept the dollar signs here: 'all the $watchers / $observers'. What for? For those not in the know, it seems that 'watchers' and '$watchers' might be different things. An example of such $confusion: http://ng.malsup.com/#!/scope-vs-$scope

When you want to change the `$location` from outside Angular (for example, through a DOM Event or
during testing) - you must call `$apply` to propagate the changes.

Expand Down