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

Commit bbf74f9

Browse files
committed
docs(*): fix headlines
1 parent 62ad450 commit bbf74f9

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

docs/content/guide/$location.ngdoc

+28-28
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@sortOrder 500
44
@description
55

6-
# What does it do?
6+
# Using the `$location` service
77

88
The `$location` service parses the URL in the browser address bar (based on [`window.location`](https://developer.mozilla.org/en/window.location)) and makes the URL available to
99
your application. Changes to the URL in the address bar are reflected into the `$location` service and
@@ -76,7 +76,7 @@ the current URL in the browser.
7676
It does not cause a full page reload when the browser URL is changed. To reload the page after
7777
changing the URL, use the lower-level API, `$window.location.href`.
7878

79-
# General overview of the API
79+
## General overview of the API
8080

8181
The `$location` service can behave differently, depending on the configuration that was provided to
8282
it when it was instantiated. The default configuration is suitable for many applications, for
@@ -85,7 +85,7 @@ others customizing the configuration can enable new features.
8585
Once the `$location` service is instantiated, you can interact with it via jQuery-style getter and
8686
setter methods that allow you to get or change the current URL in the browser.
8787

88-
## `$location` service configuration
88+
### `$location` service configuration
8989

9090
To configure the `$location` service, retrieve the
9191
{@link ng.$locationProvider $locationProvider} and set the parameters as follows:
@@ -113,12 +113,12 @@ To configure the `$location` service, retrieve the
113113
Prefix used for Hashbang URLs (used in Hashbang mode or in legacy browsers in HTML5 mode).<br />
114114
Default: `'!'`
115115

116-
### Example configuration
116+
#### Example configuration
117117
```js
118118
$locationProvider.html5Mode(true).hashPrefix('*');
119119
```
120120

121-
## Getter and setter methods
121+
### Getter and setter methods
122122

123123
`$location` service provides getter methods for read-only parts of the URL (absUrl, protocol, host,
124124
port) and getter / setter methods for url, path, search, hash:
@@ -137,7 +137,7 @@ change multiple segments in one go, chain setters like this:
137137
$location.path('/newValue').search({key: value});
138138
```
139139

140-
## Replace method
140+
### Replace method
141141

142142
There is a special `replace` method which can be used to tell the $location service that the next
143143
time the $location service is synced with the browser, the last history record should be replaced
@@ -173,7 +173,7 @@ encoded.
173173
`/path?search=a&b=c#hash`. The segments are encoded as well.
174174

175175

176-
# Hashbang and HTML5 Modes
176+
## Hashbang and HTML5 Modes
177177

178178
`$location` service has two configuration modes which control the format of the URL in the browser
179179
address bar: **Hashbang mode** (the default) and the **HTML5 mode** which is based on using the
@@ -221,15 +221,15 @@ facilitate the browser URL change and history management.
221221
</tbody>
222222
</table>
223223

224-
## Hashbang mode (default mode)
224+
### Hashbang mode (default mode)
225225

226226
In this mode, `$location` uses Hashbang URLs in all browsers.
227227
AngularJS also does not intercept and rewrite links in this mode. I.e. links work
228228
as expected and also perform full page reloads when other parts of the url
229229
than the hash fragment was changed.
230230

231231

232-
### Example
232+
#### Example
233233

234234
```js
235235
it('should show example', function() {
@@ -255,7 +255,7 @@ it('should show example', function() {
255255
});
256256
```
257257

258-
## HTML5 mode
258+
### HTML5 mode
259259

260260
In HTML5 mode, the `$location` service getters and setters interact with the browser URL address
261261
through the HTML5 history API. This allows for use of regular URL path and search segments,
@@ -271,7 +271,7 @@ Note that in this mode, AngularJS intercepts all links (subject to the "Html lin
271271
and updates the url in a way that never performs a full page reload.
272272

273273

274-
### Example
274+
#### Example
275275

276276
```js
277277
it('should show example', function() {
@@ -320,14 +320,14 @@ it('should show example (when browser doesn\'t support HTML5 mode', function() {
320320
});
321321
```
322322

323-
### Fallback for legacy browsers
323+
#### Fallback for legacy browsers
324324

325325
For browsers that support the HTML5 history API, `$location` uses the HTML5 history API to write
326326
path and search. If the history API is not supported by a browser, `$location` supplies a Hashbang
327327
URL. This frees you from having to worry about whether the browser viewing your app supports the
328328
history API or not; the `$location` service makes this transparent to you.
329329

330-
### HTML link rewriting
330+
#### HTML link rewriting
331331

332332
When you use HTML5 history API mode, you will not need special hashbang links. All you have to do
333333
is specify regular URL links, such as: `<a href="/some?foo=bar">link</a>`
@@ -361,7 +361,7 @@ Note that [attribute name normalization](guide/directive#normalization) does not
361361
`'internalLink'` will **not** match `'internal-link'`.
362362

363363

364-
### Relative links
364+
#### Relative links
365365

366366
Be sure to check all relative links, images, scripts etc. AngularJS requires you to specify the url
367367
base in the head of your main html file (`<base href="/my-base/index.html">`) unless `html5Mode.requireBase`
@@ -374,14 +374,14 @@ will only change `$location.hash()` and not modify the url otherwise. This is us
374374
to anchors on the same page without needing to know on which page the user currently is.
375375

376376

377-
### Server side
377+
#### Server side
378378

379379
Using this mode requires URL rewriting on server side, basically you have to rewrite all your links
380380
to entry point of your application (e.g. index.html). Requiring a `<base>` tag is also important for
381381
this case, as it allows AngularJS to differentiate between the part of the url that is the application
382382
base and the path that should be handled by the application.
383383

384-
### Base href constraints
384+
#### Base href constraints
385385

386386
The `$location` service is not able to function properly if the current URL is outside the URL given
387387
as the base href. This can have subtle confusing consequences...
@@ -403,7 +403,7 @@ legacy browsers and hashbang links in modern browser:
403403
- Modern browser will rewrite hashbang URLs to regular URLs.
404404
- Older browsers will redirect regular URLs to hashbang URLs.
405405

406-
### Example
406+
#### Example
407407

408408
Here you can see two `$location` instances that show the difference between **Html5 mode** and **Html5 Fallback mode**.
409409
Note that to simulate different levels of browser support, the `$location` instances are connected to
@@ -415,7 +415,7 @@ redirect to regular / hashbang url, as this conversion happens only during parsi
415415

416416
In these examples we use `<base href="/base/index.html" />`. The inputs represent the address bar of the browser.
417417

418-
#### Browser in HTML5 mode
418+
##### Browser in HTML5 mode
419419
<example module="html5-mode" name="location-html5-mode">
420420
<file name="index.html">
421421
<div ng-controller="LocationController">
@@ -565,7 +565,7 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
565565

566566
</example>
567567

568-
#### Browser in HTML5 Fallback mode (Hashbang mode)
568+
##### Browser in HTML5 Fallback mode (Hashbang mode)
569569
<example module="hashbang-mode" name="location-hashbang-mode">
570570
<file name="index.html">
571571
<div ng-controller="LocationController">
@@ -718,15 +718,15 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
718718

719719
</example>
720720

721-
# Caveats
721+
## Caveats
722722

723-
## Page reload navigation
723+
### Page reload navigation
724724

725725
The `$location` service allows you to change only the URL; it does not allow you to reload the
726726
page. When you need to change the URL and reload the page or navigate to a different page, please
727727
use a lower level API, {@link ng.$window $window.location.href}.
728728

729-
## Using $location outside of the scope life-cycle
729+
### Using $location outside of the scope life-cycle
730730

731731
`$location` knows about AngularJS's {@link ng.$rootScope.Scope scope} life-cycle. When a URL changes in
732732
the browser it updates the `$location` and calls `$apply` so that all
@@ -738,15 +738,15 @@ propagate this change into browser and will notify all the {@link ng.$rootScope.
738738
When you want to change the `$location` from outside AngularJS (for example, through a DOM Event or
739739
during testing) - you must call `$apply` to propagate the changes.
740740

741-
## $location.path() and ! or / prefixes
741+
### $location.path() and ! or / prefixes
742742

743743
A path should always begin with forward slash (`/`); the `$location.path()` setter will add the
744744
forward slash if it is missing.
745745

746746
Note that the `!` prefix in the hashbang mode is not part of `$location.path()`; it is actually
747747
`hashPrefix`.
748748

749-
## Crawling your app
749+
### Crawling your app
750750

751751
To allow indexing of your AJAX application, you have to add special meta tag in the head section of
752752
your document:
@@ -761,7 +761,7 @@ see [Making AJAX Applications
761761
Crawlable](http://code.google.com/web/ajaxcrawling/docs/specification.html).
762762

763763

764-
# Testing with the $location service
764+
## Testing with the $location service
765765

766766
When using `$location` service during testing, you are outside of the angular's {@link
767767
ng.$rootScope.Scope scope} life-cycle. This means it's your responsibility to call `scope.$apply()`.
@@ -785,14 +785,14 @@ describe('serviceUnderTest', function() {
785785
```
786786

787787

788-
# Migrating from earlier AngularJS releases
788+
## Migrating from earlier AngularJS releases
789789

790790
In earlier releases of AngularJS, `$location` used `hashPath` or `hashSearch` to process path and
791791
search methods. With this release, the `$location` service processes path and search methods and
792792
then uses the information it obtains to compose hashbang URLs (such as
793793
`http://server.com/#!/path?search=a`), when necessary.
794794

795-
## Changes to your code
795+
### Changes to your code
796796

797797
<table class="table">
798798
<thead>
@@ -884,6 +884,6 @@ angular.module('locationExample', [])
884884
</file>
885885
</example>
886886

887-
# Related API
887+
## Related API
888888

889889
* {@link ng.$location `$location` API}

src/ng/compile.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,7 @@
10301030
*
10311031
* See issue [#2573](https://github.com/angular/angular.js/issues/2573).
10321032
*
1033-
* #### `transclude: element` in the replace template root can have
1034-
* unexpected effects
1033+
* #### `transclude: element` in the replace template root can have unexpected effects
10351034
*
10361035
* When the replace template has a directive at the root node that uses
10371036
* {@link $compile#-transclude- `transclude: element`}, e.g.

0 commit comments

Comments
 (0)