I am new to programming.
I want to try using angular to display elements by rows, with a limit of 3 elements per row. (Use *ngFor)
For example, like this picture 3 elements by row
I used the slice pipeline, but this only requires the 3rd element.
<ul> <li *ngFor="let item of items | slice:0:3"> {{ item }} </li> </ul>
Can anyone help me or show me a code example
You can use a simple
*ngFor
and useCSS Grid
with any row or column to sort the elements. Alternatively, you can addgrid-auto-flow: column;
to sort the elements in the column.You can try this code on stackblitz