@@ -437,7 +437,9 @@ function $HttpProvider() {
437
437
*
438
438
* ## General usage
439
439
* The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} —
440
- * that is used to generate an HTTP request and returns a {@link ng.$q promise}.
440
+ * that is used to generate an HTTP request and returns a {@link ng.$q promise} that is
441
+ * resolved (request success) or rejected (request failure) with a
442
+ * {@link ng.$http#$http-returns response} object.
441
443
*
442
444
* ```js
443
445
* // Simple GET request example:
@@ -453,24 +455,6 @@ function $HttpProvider() {
453
455
* });
454
456
* ```
455
457
*
456
- * The response object has these properties:
457
- *
458
- * - **data** – `{string|Object}` – The response body transformed with the transform
459
- * functions.
460
- * - **status** – `{number}` – HTTP status code of the response.
461
- * - **headers** – `{function([headerName])}` – Header getter function.
462
- * - **config** – `{Object}` – The configuration object that was used to generate the request.
463
- * - **statusText** – `{string}` – HTTP status text of the response.
464
- * - **xhrStatus** – `{string}` – Status of the XMLHttpRequest (`complete`, `error`, `timeout` or `abort`).
465
- *
466
- * A response status code between 200 and 299 is considered a success status and will result in
467
- * the success callback being called. Any response status code outside of that range is
468
- * considered an error status and will result in the error callback being called.
469
- * Also, status codes less than -1 are normalized to zero. -1 usually means the request was
470
- * aborted, e.g. using a `config.timeout`.
471
- * Note that if the response is a redirect, XMLHttpRequest will transparently follow it, meaning
472
- * that the outcome (success or error) will be determined by the final response status code.
473
- *
474
458
*
475
459
* ## Shortcut methods
476
460
*
@@ -856,8 +840,33 @@ function $HttpProvider() {
856
840
* - **responseType** - `{string}` - see
857
841
* [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).
858
842
*
859
- * @returns {HttpPromise } Returns a {@link ng.$q `Promise}` that will be resolved to a response object
860
- * when the request succeeds or fails.
843
+ * @returns {HttpPromise } A {@link ng.$q `Promise}` that will be resolved (request success)
844
+ * or rejected (request failure) with a response object.
845
+ *
846
+ * The response object has these properties:
847
+ *
848
+ * - **data** – `{string|Object}` – The response body transformed with
849
+ * the transform functions.
850
+ * - **status** – `{number}` – HTTP status code of the response.
851
+ * - **headers** – `{function([headerName])}` – Header getter function.
852
+ * - **config** – `{Object}` – The configuration object that was used
853
+ * to generate the request.
854
+ * - **statusText** – `{string}` – HTTP status text of the response.
855
+ * - **xhrStatus** – `{string}` – Status of the XMLHttpRequest
856
+ * (`complete`, `error`, `timeout` or `abort`).
857
+ *
858
+ *
859
+ * A response status code between 200 and 299 is considered a success status
860
+ * and will result in the success callback being called. Any response status
861
+ * code outside of that range is considered an error status and will result
862
+ * in the error callback being called.
863
+ * Also, status codes less than -1 are normalized to zero. -1 usually means
864
+ * the request was aborted, e.g. using a `config.timeout`. More information
865
+ * about the status might be available in the `xhrStatus` property.
866
+ *
867
+ * Note that if the response is a redirect, XMLHttpRequest will transparently
868
+ * follow it, meaning that the outcome (success or error) will be determined
869
+ * by the final response status code.
861
870
*
862
871
*
863
872
* @property {Array.<Object> } pendingRequests Array of config objects for currently pending
@@ -1107,8 +1116,9 @@ function $HttpProvider() {
1107
1116
*
1108
1117
* @param {string|TrustedObject } url Absolute or relative URL of the resource that is being requested;
1109
1118
* or an object created by a call to `$sce.trustAsResourceUrl(url)`.
1110
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1111
- * @returns {HttpPromise } Future object
1119
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1120
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1121
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1112
1122
*/
1113
1123
1114
1124
/**
@@ -1120,8 +1130,9 @@ function $HttpProvider() {
1120
1130
*
1121
1131
* @param {string|TrustedObject } url Absolute or relative URL of the resource that is being requested;
1122
1132
* or an object created by a call to `$sce.trustAsResourceUrl(url)`.
1123
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1124
- * @returns {HttpPromise } Future object
1133
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1134
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1135
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1125
1136
*/
1126
1137
1127
1138
/**
@@ -1133,8 +1144,9 @@ function $HttpProvider() {
1133
1144
*
1134
1145
* @param {string|TrustedObject } url Absolute or relative URL of the resource that is being requested;
1135
1146
* or an object created by a call to `$sce.trustAsResourceUrl(url)`.
1136
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1137
- * @returns {HttpPromise } Future object
1147
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1148
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1149
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1138
1150
*/
1139
1151
1140
1152
/**
@@ -1175,8 +1187,9 @@ function $HttpProvider() {
1175
1187
*
1176
1188
* @param {string|TrustedObject } url Absolute or relative URL of the resource that is being requested;
1177
1189
* or an object created by a call to `$sce.trustAsResourceUrl(url)`.
1178
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1179
- * @returns {HttpPromise } Future object
1190
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1191
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1192
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1180
1193
*/
1181
1194
createShortMethods ( 'get' , 'delete' , 'head' , 'jsonp' ) ;
1182
1195
@@ -1189,8 +1202,9 @@ function $HttpProvider() {
1189
1202
*
1190
1203
* @param {string } url Relative or absolute URL specifying the destination of the request
1191
1204
* @param {* } data Request content
1192
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1193
- * @returns {HttpPromise } Future object
1205
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1206
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1207
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1194
1208
*/
1195
1209
1196
1210
/**
@@ -1202,8 +1216,9 @@ function $HttpProvider() {
1202
1216
*
1203
1217
* @param {string } url Relative or absolute URL specifying the destination of the request
1204
1218
* @param {* } data Request content
1205
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1206
- * @returns {HttpPromise } Future object
1219
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1220
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1221
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1207
1222
*/
1208
1223
1209
1224
/**
@@ -1215,8 +1230,9 @@ function $HttpProvider() {
1215
1230
*
1216
1231
* @param {string } url Relative or absolute URL specifying the destination of the request
1217
1232
* @param {* } data Request content
1218
- * @param {Object= } config Optional configuration object. See https://docs.angularjs.org/api/ng/service/$http#usage
1219
- * @returns {HttpPromise } Future object
1233
+ * @param {Object= } config Optional configuration object. See {@link ng.$http#$http-arguments `$http()` arguments}.
1234
+ * @returns {HttpPromise } A Promise that will be resolved or rejected with a response object.
1235
+ * See {@link ng.$http#$http-returns `$http()` return value}.
1220
1236
*/
1221
1237
createShortMethodsWithData ( 'post' , 'put' , 'patch' ) ;
1222
1238
0 commit comments