'Angular service syntax
I'm trying to post certain data to the backend of my application (node.js and mysql) to send an email with this data.
I want to include two objects (account and labSwap) in this post method, what is the correct syntax/way to do this?
Thank you.
account.service.ts:
notifyLecturer(account: Account, labSwap: LabSwap) {
return this.http.post(`${baseUrl}/notifyLecturer`, account) , this.http.post(`${baseUrl}/notifyLecturer`, labSwap);
// or &&?
}
Solution 1:[1]
is this what you are after??
notifyLecturer(account: Account, labSwap: LabSwap) {
return this.http.post(`${baseUrl}/notifyLecturer`, {account,labSwap})
}
payload will be like
{
account:{accountJsonContent}, labSwap:{labswapJsonContent}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Antoniossss |
