I have a situation where I receive a json object and within json data is a section that look something like this
{
"elName": "elCst3",
"label": "Label 3",
"type": "input",
"content": "some text",
}
This is assigned to $scope.data
The type expression in the object can be input
or textarea
In my html template, depending on which value the TYPE is I am supposed to load either a textfield (input/text) or textarea element.
Pseudo logic of it is something like this..
IF {{data.type}} == "input" then
<input id="data.elName" type="text" value="{{data.content}}">
ELSE IF {{data.type}} == "textarea" then
<textarea id="data.elName">{{data.content}}</textarea>
ENDIF
How could I in the best and simplest way approach this in Angularjs?
Thanks!