It seems that ngfor is generating divs one by one, resulting in a poor design where they are stacked on top of each other. I would like to achieve a layout like this:
[1] [2] [3]
[4] [5] [6]
However, the current outcome looks like this:
[ 1 ]
[ 2 ]
[ 3 ]
and so on..
This is my JSON structure:
[
{
"id_nivel": "1",
"nombre": "A",
"constelacion": "AA",
"descripcion": "AAAAAAAAAAAAAAAAAAAAA"
},
{
"id_nivel": "2",
"nombre": "B",
"constelacion": "BB",
"descripcion": "BBBBBBBBBBBBBBBBBBBBB"
},
{
"id_nivel": "3",
"nombre": "C",
"constelacion": "CC",
"descripcion": "CCCCCCCCCCCCCCCCCCCCC"
},
{
"id_nivel": "4",
"nombre": "D",
"constelacion": "DD",
"descripcion": "DDDDDDDDDDDDDDDDDDDDD"
},
{
"id_nivel": "5",
"nombre": "E",
"constelacion": "EE",
"descripcion": "EEEEEEEEEEEEEEEEEEEEE"
},
{
"id_nivel": "6",
"nombre": "F",
"constelacion": "FF",
"descripcion": "FFFFFFFFFFFFFFFFFFFF"
}
]
The main issue lies here:
<div class="app flex-row align-items-center">
<div class="container">
<div *ngFor="let data of Const" class="row">
<div class="card-deck">
<div class="card col-md-4">
<div class="card-block">
<h4 class="card-title">Level {{data.id_nivel}} - {{data.nombre}} </h4>
<p class="card-text"> {{data.descripcion}}</p>
</div>
</div>
</div>
</div>
</div>
To see more details, please visit this Plunker link: