@@ -718,15 +718,15 @@ In these examples we use `
`. The inputs represen
-# Caveats
+## Caveats
-## Page reload navigation
+### Page reload navigation
The `$location` service allows you to change only the URL; it does not allow you to reload the
page. When you need to change the URL and reload the page or navigate to a different page, please
use a lower level API, {@link ng.$window $window.location.href}.
-## Using $location outside of the scope life-cycle
+### Using $location outside of the scope life-cycle
`$location` knows about AngularJS's {@link ng.$rootScope.Scope scope} life-cycle. When a URL changes in
the browser it updates the `$location` and calls `$apply` so that all
@@ -738,7 +738,7 @@ propagate this change into browser and will notify all the {@link ng.$rootScope.
When you want to change the `$location` from outside AngularJS (for example, through a DOM Event or
during testing) - you must call `$apply` to propagate the changes.
-## $location.path() and ! or / prefixes
+### $location.path() and ! or / prefixes
A path should always begin with forward slash (`/`); the `$location.path()` setter will add the
forward slash if it is missing.
@@ -746,22 +746,17 @@ forward slash if it is missing.
Note that the `!` prefix in the hashbang mode is not part of `$location.path()`; it is actually
`hashPrefix`.
-## Crawling your app
+### Crawling your app
-To allow indexing of your AJAX application, you have to add special meta tag in the head section of
-your document:
-
-```html
-
-```
-
-This will cause crawler bot to request links with `_escaped_fragment_` param so that your server
-can recognize the crawler and serve a HTML snapshots. For more information about this technique,
-see [Making AJAX Applications
-Crawlable](http://code.google.com/web/ajaxcrawling/docs/specification.html).
+Most modern search engines are able to crawl AJAX applications with dynamic content, provided all
+included resources are available to the crawler bots.
+There also exists a special
+[AJAX crawling scheme](http://code.google.com/web/ajaxcrawling/docs/specification.html) developed by
+Google that allows bots to crawl the static equivalent of a dynamically generated page,
+but this schema has been deprecated, and support for it may vary by search engine.
-# Testing with the $location service
+## Testing with the $location service
When using `$location` service during testing, you are outside of the angular's {@link
ng.$rootScope.Scope scope} life-cycle. This means it's your responsibility to call `scope.$apply()`.
@@ -784,85 +779,6 @@ describe('serviceUnderTest', function() {
});
```
-
-# Migrating from earlier AngularJS releases
-
-In earlier releases of AngularJS, `$location` used `hashPath` or `hashSearch` to process path and
-search methods. With this release, the `$location` service processes path and search methods and
-then uses the information it obtains to compose hashbang URLs (such as
-`http://server.com/#!/path?search=a`), when necessary.
-
-## Changes to your code
-
-
-
-
- Navigation inside the app |
- Change to |
-
-
-
-
-
- $location.href = value $location.hash = value $location.update(value) $location.updateHash(value) |
- $location.path(path).search(search) |
-
-
-
- $location.hashPath = path |
- $location.path(path) |
-
-
-
- $location.hashSearch = search |
- $location.search(search) |
-
-
-
- Navigation outside the app
- | Use lower level API
- |
-
-
- $location.href = value $location.update(value) |
- $window.location.href = value |
-
-
-
- $location[protocol | host | port | path | search] |
- $window.location[protocol | host | port | path | search] |
-
-
-
- Read access
- | Change to
- |
-
-
- $location.hashPath |
- $location.path() |
-
-
-
- $location.hashSearch |
- $location.search() |
-
-
-
- $location.href $location.protocol $location.host $location.port $location.hash |
- $location.absUrl() $location.protocol() $location.host() $location.port() $location.path() + $location.search() |
-
-
-
- $location.path $location.search |
- $window.location.path $window.location.search |
-
-
-
-
## Two-way binding to $location
Because `$location` uses getters/setters, you can use `ng-model-options="{ getterSetter: true }"`
@@ -884,6 +800,6 @@ angular.module('locationExample', [])
-# Related API
+## Related API
* {@link ng.$location `$location` API}
diff --git a/docs/content/guide/migration.ngdoc b/docs/content/guide/migration.ngdoc
index 376295665999..e05027a6e558 100644
--- a/docs/content/guide/migration.ngdoc
+++ b/docs/content/guide/migration.ngdoc
@@ -505,6 +505,36 @@ Note that values that have been passed through the `$interpolate` service within
`URL` or `MEDIA_URL` will have already been sanitized, so you would not need to sanitize
these values again.
+
+
+Due to **[1e9ead](https://github.com/angular/angular.js/commit/1e9eadcd72dbbd5c67dae8328a63e535cfa91ff9)**,
+binding {@link ng.$sce#trustAs trustAs()} and the short versions
+({@link ng.$sce#trustAsResourceUrl trustAsResourceUrl()} et al.) to
+{@link ng.ngSrc}, {@link ng.ngSrcset}, and {@link ng.ngHref} will now raise an infinite digest error:
+
+```js
+ $scope.imgThumbFn = function(id) {
+ return $sce.trustAsResourceUrl(someService.someUrl(id));
+ };
+```
+
+```html
+
![]()
+```
+This is because {@link ng.$interpolate} is now responsible for sanitizing
+the attribute value, and its watcher receives a new object from `trustAs()`
+on every digest.
+To migrate, compute the trusted value only when the input value changes:
+
+```js
+ $scope.$watch('imgId', function(id) {
+ $scope.imgThumb = $sce.trustAsResourceUrl(someService.someUrl(id));
+ });
+```
+
+```html
+
![]()
+```
diff --git a/src/ng/compile.js b/src/ng/compile.js
index a257c0b5f096..6471240e6692 100644
--- a/src/ng/compile.js
+++ b/src/ng/compile.js
@@ -1030,8 +1030,7 @@
*
* See issue [#2573](https://github.com/angular/angular.js/issues/2573).
*
- * #### `transclude: element` in the replace template root can have
- * unexpected effects
+ * #### `transclude: element` in the replace template root can have unexpected effects
*
* When the replace template has a directive at the root node that uses
* {@link $compile#-transclude- `transclude: element`}, e.g.