Hi I am new to angular and i need to make something that renders a form using JSON and that JSON also has all the events and functions too. This is my Html Component
<div *ngFor="let form of forms; index as i ">
<div *ngIf="form.type == 'input'">
<input type="text" value="{{ form.value }}" ("{{form.event}}") = "{{form.function}}"/>
</div>
</div>
This is my TS file,
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.scss']
})
export class FormComponent implements OnInit {
forms: any
constructor() { }
ngOnInit(): void {
this.forms = [
{
'type' : 'input',
'value' : '123',
'event' : 'click',
'function' : 'show',
},
]
}
show(a,b){
console.log('hello');
}
}
I can not find a way to generate the HTML with the events and function from my JSON Array.