I am trying to show JSON array data in table row. But I am doing it wrong through ng-repeat. I have a text input field with read only feature inside the table row. I have to show inside the text input field.
JSON data :
$scope.list=[
{
"ID": "1",
"Source": [
"AA",
"AVV",
"WEB",
"DEB"
]
}
]
My View:-
<tbody>
<tr role="row" class="">
<td class="sorting_1" ng-repeat="row in list.Source">
<input readonly="readonly" id="reg_input" class="form-control" type="text"/>
</td>
</tr>
</tbody>
My table header is fixed So I haven't included that.
EDIT:- Updated View
<table id="datatable_demo" class="table>
<thead>
<tr role="row">
<th class="text-center">Source</th>
<th class="text-center">Target</th>
</tr>
</thead>
<tbody>
<tr role="row" class="" ng-repeat="ff in setup_list">
<td class="sorting_1" ng-repeat="data in ff.SourcePortGroups track by $index">
<input readonly="readonly" id="reg_input" ng-model="data" class="form-control" type="text"/>
</td>
<td>
<select id="reg_select" class="form-control">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
</td>
</tr>
</tbody>
</table>
list.Sourceyou needlist[0].Source, sincelistis an array (without a reason)<input>Sourcethen you have to use anotherng-repeatinsideng-repeat.value="row"in your input only, that's it.