I am attempting to generate HTML code dynamically from a stored JSON file. The JSON file format:
{
"fields": [
{
"name": "service type",
"type": "text|radio|checkbox|date",
"placeholder": "Service Type",
"value": "",
"checked": "true"
},
{
"name": "service type",
"type": "text|radio|checkbox|date",
"placeholder": "Service Type"
}
]
}
However the type of the DOM element changes according to the JSON file. For example, if type: text, then this has to be generated:
<input type="text" name="service type" value="">
I'm using AngularJS. How can I implement this?