You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But if we want to post this data using the AngularJS' `$http` service we can:
453
472
454
473
```JavaScript
455
474
$http({
456
-
method:'GET',
457
-
url:'/someUrl',
458
-
timeout:1000
475
+
method:'POST',
476
+
url:'/example/new',
477
+
data: data
478
+
})
479
+
.then(function (response) {
480
+
alert(response);
459
481
});
460
482
```
461
-
Another way to use `$http` is by calling its methods:
483
+
or we can even:
462
484
463
485
```JavaScript
464
-
$http.get('/someUrl');
486
+
$http.post('/someUrl', data)
487
+
.then(function (response) {
488
+
alert(response);
489
+
});
465
490
```
466
-
The second option provides pre-configured version, which creates a HTTP GET request to the given URL.
491
+
The second option provides pre-configured version, which creates a HTTP POST request to the given URL.
467
492
468
-
Even higher level of abstraction is being created by `$resource`, which is build over the `$http` service.
493
+
Even higher level of abstraction is being created by `$resource`, which is build over the `$http` service. We will take a further look at this service in [Active Record](#active-record) and [Proxy](#proxy) sections.
0 commit comments