Skip to content

Commit f1d4782

Browse files
committed
docs($http): link to the usage section when config is mentioned
This makes it easier for beginners to find out what the config object looks like Closes angular#12949
1 parent 0df4ff8 commit f1d4782

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/ng/http.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,15 @@ function $HttpProvider() {
425425
*
426426
*
427427
* ## General usage
428-
* The `$http` service is a function which takes a single argument — a configuration object —
428+
* The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object}
429429
* that is used to generate an HTTP request and returns a {@link ng.$q promise}.
430430
*
431431
* ```js
432-
* // Simple GET request example :
433-
* $http.get('/someUrl').
434-
* then(function(response) {
432+
* // Simple GET request example:
433+
* $http({
434+
* method: 'GET',
435+
* url: '/someUrl'
436+
* }).then(function(response) {
435437
* // this callback will be called asynchronously
436438
* // when the response is available
437439
* }, function(response) {
@@ -440,8 +442,9 @@ function $HttpProvider() {
440442
* });
441443
* ```
442444
*
445+
* There are also shortcut methods available:
443446
* ```js
444-
* // Simple POST request example (passing data) :
447+
* // Simple POST request shortcut example (passing data) :
445448
* $http.post('/someUrl', {msg:'hello word!'}).
446449
* then(function(response) {
447450
* // this callback will be called asynchronously
@@ -655,7 +658,7 @@ function $HttpProvider() {
655658
*
656659
* There are two kinds of interceptors (and two kinds of rejection interceptors):
657660
*
658-
* * `request`: interceptors get called with a http `config` object. The function is free to
661+
* * `request`: interceptors get called with a http {@link $http#usage `config`} object. The function is free to
659662
* modify the `config` object or create a new one. The function needs to return the `config`
660663
* object directly, or a promise containing the `config` or a new `config` object.
661664
* * `requestError`: interceptor gets called when a previous interceptor threw an error or

0 commit comments

Comments
 (0)