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

docs($http): remove outdated part about $http outside of $apply phase #5485

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletions src/ng/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,34 +223,7 @@ function $HttpProvider() {
* XMLHttpRequest will transparently follow it, meaning that the error callback will not be
* called for such responses.
*
* # Calling $http from outside AngularJS
* The `$http` service will not actually send the request until the next `$digest()` is
* executed. Normally this is not an issue, since almost all the time your call to `$http` will
* be from within a `$apply()` block.
* If you are calling `$http` from outside Angular, then you should wrap it in a call to
* `$apply` to cause a $digest to occur and also to handle errors in the block correctly.
*
* ```
* $scope.$apply(function() {
* $http(...);
* });
* ```
*
* # Writing Unit Tests that use $http
* When unit testing you are mostly responsible for scheduling the `$digest` cycle. If you do
* not trigger a `$digest` before calling `$httpBackend.flush()` then the request will not have
* been made and `$httpBackend.expect(...)` expectations will fail. The solution is to run the
* code that calls the `$http()` method inside a $apply block as explained in the previous
* section.
*
* ```
* $httpBackend.expectGET(...);
* $scope.$apply(function() {
* $http.get(...);
* });
* $httpBackend.flush();
* ```
*
*
* # Shortcut methods
*
* Since all invocations of the $http service require passing in an HTTP method and URL, and
Expand Down