Complete the code to send a PUT request using Angular's HttpClient.
this.http.[1]('https://api.example.com/items/1', updatedItem).subscribe(response => { console.log('Item updated', response); });
The put method sends a PUT request to update data on the server.
Complete the code to send a DELETE request to remove an item.
this.http.[1]('https://api.example.com/items/1').subscribe(() => { console.log('Item deleted'); });
The delete method sends a DELETE request to remove data from the server.
Fix the error in the code to correctly send a PUT request with HttpClient.
this.http.[1]('https://api.example.com/items/1', updatedItem).subscribe(response => { console.log('Updated', response); });
The PUT request requires both the URL and the data to update. The method is put.
Fill both blanks to send a DELETE request and handle the response.
this.http.[1]('https://api.example.com/items/1').subscribe({ next: () => console.log('Deleted'), error: ([2]) => console.error('Error', [2]) });
Use delete to send the request and a variable like err to catch errors.
Fill all three blanks to send a PUT request with updated data and handle success and error.
this.http.[1]('https://api.example.com/items/1', updatedItem).subscribe({ next: ([2]) => console.log('Success', [2]), error: ([3]) => console.error('Failed', [3]) });
Use put to update data, and name the success and error parameters clearly.
