I am encountering a significant issue when trying to add data to a table connected with the Spring database. The problem arises specifically when I attempt to add new data to the table, but encounter errors when choosing options from a Combo Box. This is the error message I receive:
zone-evergreen.js:2952 POST http://localhost:4200/api/cars 400 (Bad Request)
HttpErrorResponse {headers: HttpHeaders, status: 400, statusText: "Bad Request", url: "http://localhost:4200/api/cars", ok: false, …}
I suspect that this issue is related to a problem with the links and possibly a relationship, however, I am unsure how to resolve it. Here are my model structures:
export class carStatus {
id: number;
name: string;
}
//carStatus.model.ts (TypeScript)
export class carType {
id: number;
name: string;
}
//carType.model.ts (TypeScript)
To provide more context on the issue, below are the services and components involved in adding vehicles (additional files available upon request):
car-status.service.ts (note: carType has a similar service structure)
config.service.ts (all functions link to a URL specified in proxy.conf.json file)
{
"/api": {
"target": "xxx(link)",
"secure": false,
"changeOrigin": true,
"logLevel": "debug"
}
}
Additionally, here is the HTML code associated with this task:
If you have insights into why adding data without utilizing the combo box feature works seamlessly, while encountering errors upon selection, please provide guidance on what could be causing this issue and potential solutions. My colleague responsible for Spring backend operations claims everything is functioning correctly on their end, as verified through Postman tests. However, in my table, the combo box columns display "[object object]". Here are snapshots of a query made via Postman and part of my table for reference:
I appreciate your understanding as this is only my second question posted here. I am seeking assistance as I am not able to find a resolution to the issue on my own and previous attempts have been unsuccessful. Your help is greatly appreciated.