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

Commit bda87f6

Browse files
Ashpetebacondarwin
Ash
authored andcommitted
docs(guide/$location): describe workaround for collocated apps
When using Angular in the root of a domain with HTML5 URLs where there are links to external paths within the same directory, the `otherwise` route handler will catch these external files. This can be fixed by prefixing '.' onto the links to URLs that should be handled by angular routing. Original Issue: #3520 Example of Fix: http://fiddle.jshell.net/fgHf6/3/ Closes #3555
1 parent 47dff0f commit bda87f6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/content/guide/dev_guide.services.$location.ngdoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,14 @@ reload to the original link.
321321
Example: `<a href="http://angularjs.org/">link</a>`
322322
- Links starting with '/' that lead to a different base path when base is defined<br>
323323
Example: `<a href="/not-my-base/link">link</a>`
324+
325+
When running Angular in the root of a domain, along side perhaps a normal application in the same
326+
directory, the "otherwise" route handler will try to handle all the URLs, including ones that map
327+
to static files.
328+
329+
To prevent this, you can set your base href for the app to `<base href=".">` and then prefix links
330+
to URLs that should be handled with `.`. Now, links to locations, which are not to be routed by Angular,
331+
are not prefixed with `.` and will not be intercepted by the `otherwise` rule in your `$routeProvider`.
324332

325333

326334
### Server side

0 commit comments

Comments
 (0)