You can nest inputs with dynamic forms.
export class NestedObject {
@FormInput({ label: "street", type: "text" })
street;
@FormInput({ label: "city", type: "text" })
city;
}
export class User {
/* ... */
@NestedInput('Address', /* search depth */ 1)
address = new NestedObject();
}
The @NestedInput
tag have a label as first parameter and search depth as second.
You can chain nested objects with this tag. Use the search depth to control the nesting depth.
The result will be set as an object.
let formResult = {
/* ... */
address: {
street: '',
city: ''
}
}