https://jsfiddle.net/gdrkftwm/
https://i.sstatic.net/CTi2F.jpg
I have encountered a problem while creating a table from a Json object. There seems to be an extra td being generated, and I'm not sure why. I want the structure of my table to resemble the image provided:
https://i.sstatic.net/ORNB7.jpg
<div ng-app="app">
<div ng-controller="Controller">
<table border='1'>
<tr>
<th rowspan="2">Tipo de Contenido</th>
<th colspan="{{aTipoUsuarios.length}}">Tipo de Usuarios</th>
</tr>
<tr>
<td ng-repeat="usu in aTipoUsuarios">{{usu}}<td>
</tr>
</table>
</div>
</div>
angular.module('app', [])
.controller('Controller', function ($scope) {
$scope.aRoles=
[
{
"tipo_contenido": "articulos",
"tipo_usuario":{
"administrador":
{"escritura":true, "lectura":true, "eliminacion":true},
"reportante":
{"escritura":true, "lectura":true, "eliminacion":true}
}
},
{
"tipo_contenido": "informacion",
"tipo_usuario":{
"administrador":
{"escritura":true, "lectura":true, "eliminacion":true},
"reportante":
{"escritura":true, "lectura":true, "eliminacion":true}
}
},
]
$scope.aTipoUsuarios=Object.keys($scope.aRoles[0].tipo_usuario);
console.log($scope.aTipoUsuarios)
});