I'm tried to create dynamic reactive form using json file but didn't worked with me.
This the json file :
"inputs":[
{
"formcontrol":"email",
"validation":["required,email"]
},
{
"formcontrol":"password",
"validation":["required"]
},
{
"formcontrol":"firstname",
"validation":["required"]
},
{
"formcontrol":"lastname",
"validation":["required"]
}
]
This what I tried :
for(let input of inputs ) // json data
{
this.t.push(this.formBuilder.group({
input.formcontrol: ['', input.validation],
}));
}
I know what I did isn't correct but I have no clue how to solve this.