Answer the question
In order to leave comments, you need to log in
How to split into columns?
There is an array of data and there are several columns. I want to put 5 unique elements in each column using *ngFor. How can I do it?
Answer the question
In order to leave comments, you need to log in
1) create a variable that will be responsible for the number of columns:
let count = Math.round(array.lenght / 5) // array - ваш массив
let columns = []
columns.length = count
<div *ngFor="let column of columns; let i = index">
<span *ngFor="let item of newArrays[i]> {{ item }} <span>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question