I have a problem with posting data to my API built with Spring Boot.
workflow : any = {
name : "CMD1",
items : [ {
name : "work1",
content : null
}, {
name : "work2",
content : null
} ]
}
In Angular, I created a model for this workflow.
constructor(
public id:string,
public name:string,
public items: Items[]
){}
export class Items (
constructor(
public name: string,
public content: string
){} )
When I post this data from Postman, the API saves it correctly when using the top-declared structure. However, when I try to send data from a template, I struggle to format it correctly like the JSON shown above.
workflow : any = {
name : "CMD1",
items : [ {
name : "work1",
content : null
}, {
name : "work2",
content : null
} ]
}
How can I send an object within another Angular object, and which form method should I use to send the data properly? Any help would be appreciated. Thank you.