aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/http.js
diff options
context:
space:
mode:
authorMikeMac2014-01-03 23:57:43 -0600
committerIgor Minar2014-01-03 22:35:14 -0800
commit00cac6ed101cf78a7d12a0ca8a5030337b65239d (patch)
treea98de959a9ed3f6730c8a9af9c96fb29abd9a339 /src/ng/http.js
parent2e9d7cc6cb9665fa00d7796b2a51fb9a2c41af1a (diff)
downloadangular.js-00cac6ed101cf78a7d12a0ca8a5030337b65239d.tar.bz2
docs($http): makes clear $httpProvider.defaults are available at run-time
Clarifies some confusion around $http.defaults existing and able to be modified at run-time, for when run-time services may be needed in a transformation. Closes #5559 Closes #5630
Diffstat (limited to 'src/ng/http.js')
-rw-r--r--src/ng/http.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/ng/http.js b/src/ng/http.js
index 3aaad7a8..231e683e 100644
--- a/src/ng/http.js
+++ b/src/ng/http.js
@@ -291,7 +291,15 @@ function $HttpProvider() {
* `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }.
*
* The defaults can also be set at runtime via the `$http.defaults` object in the same
- * fashion. In addition, you can supply a `headers` property in the config object passed when
+ * fashion. For example:
+ *
+ * ```
+ * module.run(function($http) {
+ * $http.defaults.headers.common.Authentication = 'Basic YmVlcDpib29w'
+ * });
+ * ```
+ *
+ * In addition, you can supply a `headers` property in the config object passed when
* calling `$http(config)`, which overrides the defaults without changing them globally.
*
*
@@ -315,7 +323,9 @@ function $HttpProvider() {
* properties. These properties are by default an array of transform functions, which allows you
* to `push` or `unshift` a new transformation function into the transformation chain. You can
* also decide to completely override any default transformations by assigning your
- * transformation functions to these properties directly without the array wrapper.
+ * transformation functions to these properties directly without the array wrapper. These defaults
+ * are again available on the $http factory at run-time, which may be useful if you have run-time
+ * services you wish to be involved in your transformations.
*
* Similarly, to locally override the request/response transforms, augment the
* `transformRequest` and/or `transformResponse` properties of the configuration object passed
@@ -529,7 +539,8 @@ function $HttpProvider() {
* for added security.
*
* The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName
- * properties of either $httpProvider.defaults, or the per-request config object.
+ * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,
+ * or the per-request config object.
*
*
* @param {object} config Object describing the request to be made and how it should be