mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-28 12:55:48 +08:00
docs($location): Html5 -> HTML5
This commit is contained in:
@@ -54,7 +54,7 @@ changes to $location are reflected into the browser address bar.
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="head">seamless integration with html5 API</td>
|
<td class="head">seamless integration with HTML5 API</td>
|
||||||
<td>no</td>
|
<td>no</td>
|
||||||
<td>yes (with a fallback for legacy browsers)</td>
|
<td>yes (with a fallback for legacy browsers)</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -92,7 +92,7 @@ To configure the `$location` service, you define the `$locationConfig` service w
|
|||||||
with configuration properties:
|
with configuration properties:
|
||||||
|
|
||||||
- **html5Mode**: {boolean}<br />
|
- **html5Mode**: {boolean}<br />
|
||||||
`true` - see Html5 mode<br />
|
`true` - see HTML5 mode<br />
|
||||||
`false` - see Hashbang mode<br />
|
`false` - see Hashbang mode<br />
|
||||||
default: `false`
|
default: `false`
|
||||||
|
|
||||||
@@ -159,11 +159,11 @@ encoded.
|
|||||||
`/path?search=a&b=c#hash`. The segments are encoded as well.
|
`/path?search=a&b=c#hash`. The segments are encoded as well.
|
||||||
|
|
||||||
|
|
||||||
# Hashbang and Html5 Modes
|
# Hashbang and HTML5 Modes
|
||||||
|
|
||||||
`$location` service has two configuration modes which control the format of the URL in the browser
|
`$location` service has two configuration modes which control the format of the URL in the browser
|
||||||
address bar: **Hashbang mode** (the default) and the **Html5 mode** which is based on using the
|
address bar: **Hashbang mode** (the default) and the **HTML5 mode** which is based on using the
|
||||||
Html5 {@link http://www.w3.org/TR/html5/history.html History API}. Applications use the same API in
|
HTML5 {@link http://www.w3.org/TR/html5/history.html History API}. Applications use the same API in
|
||||||
both modes and the `$location` service will work with appropriate URL segments and browser APIs to
|
both modes and the `$location` service will work with appropriate URL segments and browser APIs to
|
||||||
facilitate the browser URL change and history management.
|
facilitate the browser URL change and history management.
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ facilitate the browser URL change and history management.
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="empty-corner-lt"></td>
|
<td class="empty-corner-lt"></td>
|
||||||
<td>Hashbang mode</td>
|
<td>Hashbang mode</td>
|
||||||
<td>Html5 mode</td>
|
<td>HTML5 mode</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</thead>
|
</thead>
|
||||||
@@ -269,7 +269,7 @@ angular.service('$locationConfig', function() {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// in browser with html5 history support:
|
// in browser with HTML5 history support:
|
||||||
// open http://host.com/#!/a -> rewrite to http://host.com/a
|
// open http://host.com/#!/a -> rewrite to http://host.com/a
|
||||||
// (replacing the http://host.com/#!/a history record)
|
// (replacing the http://host.com/#!/a history record)
|
||||||
$location.path() == '/a'
|
$location.path() == '/a'
|
||||||
@@ -351,7 +351,7 @@ takes care of all relative link issues. **Otherwise you have to specify <base
|
|||||||
|
|
||||||
### Sending links among different browsers
|
### Sending links among different browsers
|
||||||
|
|
||||||
Because of rewriting capability in Html5 mode, your users will be able to open regular url links in
|
Because of rewriting capability in HTML5 mode, your users will be able to open regular url links in
|
||||||
legacy browsers and hashbang links in modern browser:
|
legacy browsers and hashbang links in modern browser:
|
||||||
|
|
||||||
- Modern browser will rewrite hashbang URLs to regular URLs.
|
- Modern browser will rewrite hashbang URLs to regular URLs.
|
||||||
|
|||||||
@@ -96,10 +96,10 @@ function convertToHashbangUrl(url, basePath, hashPrefix) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* LocationUrl represents an url
|
* LocationUrl represents an url
|
||||||
* This object is exposed as $location service when html5 is enabled and supported
|
* This object is exposed as $location service when HTML5 mode is enabled and supported
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {string} url Html5 url
|
* @param {string} url HTML5 url
|
||||||
* @param {string} pathPrefix
|
* @param {string} pathPrefix
|
||||||
*/
|
*/
|
||||||
function LocationUrl(url, pathPrefix) {
|
function LocationUrl(url, pathPrefix) {
|
||||||
@@ -107,7 +107,7 @@ function LocationUrl(url, pathPrefix) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse given html5 (regular) url string into properties
|
* Parse given html5 (regular) url string into properties
|
||||||
* @param {string} url Html5 url
|
* @param {string} url HTML5 url
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.$$parse = function(url) {
|
this.$$parse = function(url) {
|
||||||
|
|||||||
Reference in New Issue
Block a user