Recently diving into AngularJS, I opted for version 1.6 to fetch data from my database. Everything seems to be in place, but the JSON information fails to display.
This is the snippet of my code:
<div class="row m-t-50">
{{ autos |json }}
<div class="col-md-12">
<table class="table table-striped">
<thead>
<tr>
<th>Marca</th>
<th>Modelo</th>
<th>Color</th>
<th>Año</th>
<th>Precio</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="auto in autos">
<td>{{ auto.marca }}</td>
<td>{{ auto.modelo }}</td>
<td>{{ auto.color }}</td>
<td>{{ auto.anio }}</td>
<td>{{ auto.precio }}</td>
</tr>
</tbody>
</table>
</div>
</div>
The output of {{ autos | json }}
appears as follows:
{
"data": [{
"id": "1",
"marca": "TOYOTA",
"modelo": "VC2017",
"color": "Verde",
"anio": "2017",
"precio": "250345"
}, {
"id": "2",
"marca": "NISSAN",
"modelo": "NS2017",
"color": "Azul",
"anio": "2016",
"precio": "540000"
}],
"status": 200,
"config": {
"method": "GET",
"transformRequest": [null],
"transformResponse": [null],
"jsonpCallbackParam": "callback",
"url": "php/obtener-autos.php",
"headers": {
"Accept": "application/json, text/plain, */*"
}
},
"statusText": "OK"
}
Despite having the JSON data, the displayed table remains empty. Any idea where I might have gone wrong?