Skip to content

Commit 96dfab2

Browse files
committed
docs($location): add note about breaking anchor links
As explained in angular#4608, $location injection can cause issues by inserting a / after a hash in the url, if html5mode is not enabled. Possible fix is in angular#8508.
1 parent e1c85d1 commit 96dfab2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/content/guide/$location.ngdoc

+6
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,12 @@ can recognize the crawler and serve a HTML snapshots. For more information about
703703
see [Making AJAX Applications
704704
Crawlable](http://code.google.com/web/ajaxcrawling/docs/specification.html).
705705

706+
## Injecting $location and anchor links
707+
708+
Injecting `$location` anywhere in the app, if html5mode is not enabled, may lead
709+
to the Angular breaking anchor links. Specifically, Angular will rewrite the
710+
url by adding a `/` after the hash, which breaks anchor scrolling and may cause
711+
functionality issues on applications where `$location` does not control routing.
706712

707713
# Testing with the $location service
708714

0 commit comments

Comments
 (0)