mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
parent
ee060c5377
commit
4f86e7ae90
1 changed files with 4 additions and 4 deletions
|
|
@ -18,9 +18,9 @@ The method takes a resource URL and two additional parameters:
|
|||
| Parameter | Details |
|
||||
|:--- |:--- |
|
||||
| body | The data to POST in the body of the request. |
|
||||
| options | An object containing method options which, in this case, [specify required headers](#adding-headers). |
|
||||
| options | An object containing method options which, in this case, specify required headers. |
|
||||
|
||||
The example catches errors as [described above](#error-details).
|
||||
The example catches errors as described in [HTTP client - Handle request errors](guide/http-client-request-errors.md).
|
||||
|
||||
The `HeroesComponent` initiates the actual POST operation by subscribing to the `Observable` returned by this service method.
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ The following `HeroesService` example, like the POST example, replaces a resourc
|
|||
|
||||
<code-example header="app/heroes/heroes.service.ts (updateHero)" path="http/src/app/heroes/heroes.service.ts" region="updateHero"></code-example>
|
||||
|
||||
As for any of the HTTP methods that return an observable, the caller, `HeroesComponent.update()` [must `subscribe()`](#always-subscribe "Why you must always subscribe.") to the observable returned from the `HttpClient.put()` in order to initiate the request.
|
||||
As for any of the HTTP methods that return an observable, the caller, `HeroesComponent.update()` must `subscribe()` to the observable returned from the `HttpClient.put()` in order to initiate the request.
|
||||
|
||||
## Add and updating headers
|
||||
|
||||
|
|
@ -84,4 +84,4 @@ The following example shows how, when an old token expires, you can update the a
|
|||
|
||||
<a id="url-params"></a>
|
||||
|
||||
@reviewed 2022-11-07
|
||||
@reviewed 2023-03-02
|
||||
|
|
|
|||
Loading…
Reference in a new issue