Skip to content

Commit 1f650ba

Browse files
guisouzaIgorMinar
authored andcommitted
docs(\$http): add POST request example
Closes angular#9046
1 parent d1eec47 commit 1f650ba

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/ng/http.js

+15
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ function $HttpProvider() {
230230
* with two $http specific methods: `success` and `error`.
231231
*
232232
* ```js
233+
* // Simple GET request example :
233234
* $http({method: 'GET', url: '/someUrl'}).
234235
* success(function(data, status, headers, config) {
235236
* // this callback will be called asynchronously
@@ -241,6 +242,20 @@ function $HttpProvider() {
241242
* });
242243
* ```
243244
*
245+
* ```js
246+
* // Simple POST request example (passing data) :
247+
* $http({method: 'POST', url: '/someUrl', data:{msg:'hello word!'}}).
248+
* success(function(data, status, headers, config) {
249+
* // this callback will be called asynchronously
250+
* // when the response is available
251+
* }).
252+
* error(function(data, status, headers, config) {
253+
* // called asynchronously if an error occurs
254+
* // or server returns response with an error status.
255+
* });
256+
* ```
257+
*
258+
*
244259
* Since the returned value of calling the $http function is a `promise`, you can also use
245260
* the `then` method to register callbacks, and these callbacks will receive a single argument –
246261
* an object representing the response. See the API signature and type info below for more

0 commit comments

Comments
 (0)