This is a json sample with 2 objects im retrieving:
[{"project_id":"538","proyecto":"Caja","tarea":"DEF","fecha_termino":"00-00-00","estado":"Vencido","nombre_completo":"Christiano Ronaldo","alerta":"-Analista responsable: Lionel Messi.; \r\n-Estado Actual: DEF en Construcci\u00f3n detenido por el arbitro.; \r\n-Evaluaci\u00f3n validar en caja lejos. Validacion de pin de trajetas cau.;\r\n28-06-2017 : Usuario Suspende proyecto por cambio de prioridad."},{"project_id":"538","proyecto":"Caja ","tarea":"CAT y Capacity","fecha_termino":"00-00-00","estado":"Vencido","nombre_completo":"Christiano Ronalddo","alerta":"-Analista responsable: Lionel Messi.; \r\n-Estado Actual: DEF en Construcci\u00f3n detenido por capacity de Depto de Tarjetas.; \r\n-Evaluaci\u00f3n validar en caja atalla o redbanc. Validacion de pin de trajetas cau.;\r\n28-06-2017 : Usuario Suspende proyecto por cambio de prioridad."}]
I storage the data in angular to be displayed:
scope.llamada1 = function() {
$http.get("conector.php?tipoDato=query1")
.then(function(response) {
$scope.mensajeEspera = "";
$scope.datos1 = response.data;
for(var i = 0; i < $scope.datos1.length; i++){
var currentObj = $scope.datos1[i];
currentObj.TareasObj = currentObj.tarea + ", " + currentObj.fecha_termino + ", " + currentObj.estado + ", " + currentObj.nombre_completo;
console.log(currentObj.TareasObj);
$scope.detalleProyecto = currentObj.TareasObj;
currentObj.detalleProyecto = currentObj.TareasObj;
}
$scope.detalleProyecto = currentObj.TareasObj;
});
}
I have Projects, and each project can have multiple tasks, I need to display the data like this:
<table id="tablaTareas" class="table table-striped table-bordered" >
<thead>
<tr>
<td><b>Proyecto</b></td>
<td><b>Alerta</b></td>
<td><b>Tareas</b></td>
</tr>
</thead>
<tbody>
<tr ng-repeat="x in datos1 ">
<td style="vertical-align: top;">{{x.proyecto}}</td>
<td style="vertical-align: top;">{{x.alerta}}</td>
<td style="vertical-align: top;">
<table class="table table-striped table-bordered" >
<thead>
<tr>
<td><b>Tarea</b></td>
<td><b>Termino</b></td>
<td><b>Estado</b></td>
<td><b>Responsable</b></td>
</tr>
</thead>
<tbody>
<tr ng-repeat="y in x.detalleProyecto track by $index">
<td style="vertical-align: top;">{{y.tarea}}</td>
<td style="vertical-align: top;">{{y.fecha_termino}}</td>
<td style="vertical-align: top;">{{y.estado}}</td>
<td style="vertical-align: top;">{{y.nombre_completo}}</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
I dont know what is the problem with the code, i think i may be retrieving the data in angulajs in the wrong way?
console.log (response.data)inside http.get.then () to see if there is data. if there is, then see if the datos1 has the value. and slowly you will reach a point where you will find the glitch.