@@ -305,7 +305,7 @@ history API or not; the `$location` service makes this transparent to you.
305305### Html link rewriting
306306
307307When you use the history API mode, you will need different links in different browser, but all you
308- have to do is specify regular URL links, such as: `< a href="/some?foo=bar"> link</a> `
308+ have to do is specify regular URL links, such as: `< a href="/some?foo=bar"> link</a> `
309309
310310When a user clicks on this link,
311311
@@ -316,12 +316,13 @@ When a user clicks on this link,
316316In cases like the following, links are not rewritten; instead, the browser will perform a full page
317317reload to the original link.
318318
319- - Links with an `ngExtLink` directive<br />
320- Example: `<a href="/ext/link?a=b" ng-ext-link>link</a>`
321- - Links that contain `target="_blank"`<br />
322- Example: `<a href="/ext/link?a=b" target="_blank">link</a>`
323- - Absolute links that go to a different domain<br />
319+ - Links that contain `target` element<br>
320+ Example: `<a href="/ext/link?a=b" target="_self">link</a>`
321+ - Absolute links that go to a different domain<br>
324322 Example: `<a href="http://angularjs.org/">link</a>`
323+ - Links starting with '/' that lead to a different base path when base is defined<br>
324+ Example: `<a href="/not-my-base/link">link</a>`
325+
325326
326327### Server side
327328
@@ -341,11 +342,13 @@ Applications Crawlable}.
341342
342343### Relative links
343344
344- Be sure to check all relative links, images, scripts etc. You must use an absolute path because the
345- path is going to be rewritten. You can use `<base href="" />` tag as well.
345+ Be sure to check all relative links, images, scripts etc. You must either specify the url base in
346+ the head of your main html file (`<base href="/my-base">`) or you must use absolute urls
347+ (starting with `/`) everywhere because relative urls will be resolved to absolute urls using the
348+ initial absolute url of the document, which is often different from the root of the application.
346349
347350Running Angular apps with the History API enabled from document root is strongly encouraged as it
348- takes care of all relative link issues. **Otherwise you have to specify <base href="" /> !**
351+ takes care of all relative link issues.
349352
350353### Sending links among different browsers
351354
@@ -379,9 +382,9 @@ In this examples we use `<base href="/base/index.html" />`
379382 $location.path() = {{$location.path()}}<br>
380383 $location.search() = {{$location.search()}}<br>
381384 $location.hash() = {{$location.hash()}}<br>
382- <a href="/base/first?a=b">/base/first?a=b</a> |
383- <a href="sec/ond?flag#hash">sec/ond?flag#hash</a> |
384- <a href="/base/another?search" ng-ext-link >external</a>
385+ <a href="http://www.host.com /base/first?a=b">/base/first?a=b</a> |
386+ <a href="http://www.host.com/base/ sec/ond?flag#hash">sec/ond?flag#hash</a> |
387+ <a href="/other- base/another?search">external</a>
385388 </div>
386389
387390 <div id="hashbang-mode" ng-controller="HashbangCntl">
@@ -393,9 +396,9 @@ In this examples we use `<base href="/base/index.html" />`
393396 $location.path() = {{$location.path()}}<br>
394397 $location.search() = {{$location.search()}}<br>
395398 $location.hash() = {{$location.hash()}}<br>
396- <a href="/base/first?a=b">/base/first?a=b</a> |
397- <a href="sec/ond?flag#hash">sec/ond?flag#hash</a> |
398- <a href="/base/another?search" ng-ext-link >external</a>
399+ <a href="http://www.host.com /base/first?a=b">/base/first?a=b</a> |
400+ <a href="http://www.host.com/base/ sec/ond?flag#hash">sec/ond?flag#hash</a> |
401+ <a href="/other- base/another?search">external</a>
399402 </div>
400403</div>
401404
@@ -445,7 +448,7 @@ In this examples we use `<base href="/base/index.html" />`
445448 $compileProvider.directive('ngAddressBar', function() {
446449 return function(scope, elm, attrs) {
447450 var browser = browsers[attrs.browser],
448- input = angular.element('<input type="text" / >').val(browser.url()),
451+ input = angular.element('<input type="text">').val(browser.url()),
449452 delay;
450453
451454 input.bind('keypress keyup keydown', function() {
0 commit comments