I have a little problem with creating a dynamic HTML template. To display some data in a table, I have to separate between an ordinary String and an Array. First things first: T
Do Something Like this.
<tr ng-repeat="person in persons">
<td ng-repeat="attr in query.attribs">
<span ng-show="isArray(person[attr.id])">
{{person[attr.id].toString()}}
</span>
<span ng-show="!isArray(person[attr.id])">
{{person[attr.id]}}
</span>
</td>
</tr>
You have to do some script and html changes if the value is an array like this Updated fiddle here : jsfiddle.net/Lt024p9h/7/
you can isArray but not directly inside ng-show.
you can use it like this.
$scope.isArray = angular.isArray;
so this way,
<tr ng-repeat="person in persons">
<td ng-repeat="attr in query.attribs">
<span ng-show="isArray(person[attr.id])">
<span ng-repeat="p in person[attr.id]">
{{p}}
</span>
</span>
<span ng-show="!isArray(person[attr.id])">
{{person[attr.id]}}
</span>
</td>
</tr>
Here is your updated Fiddle