Here is the JSON data I am working with:
.json
"type": [ {
"id": 2,
"secondid": "1",
"name": "f",
"positionX": 0,
"positionY": 0
}]
Alongside this data, I have a Service as shown below:
public updateposition(Model: typemodel): Observable<any> {
return this.http.post(this.apiEndPoint + '/type' + '/' + typemodel.id , typemodel);
}
Additionally, in my TypeScript file, I have declared x and y variables like so:
.ts
x: number;
y: number;
updateposition()
{
}
The objective is to update the "type" object within the JSON by utilizing values of x and y upon clicking a button in HTML. The HTML implementation is not an issue. However, I am unsure about how to proceed with updating the JSON object using the new x and y positions defined in TypeScript. My intention is to execute this task within the updateposition() function. Any recommendations or suggestions are greatly appreciated :)