Hi Martin,

I have been looking at your sample.
So your issue is how to add your data as rows of 5 elements to your virtual 
scroller? You might want to put it into chunks:

export const tail = <T>(a: Array<T>): T => a[a.length - 1];

export const chunkReducerForSize = (chunkSize = 5) => <T>(
result: T[][],
item: T
) => {
const lastElm = tail(result);
if (lastElm.length === chunkSize) {
result.push([item]);
} else {
lastElm.push(item);
}
return result;
};

export const toChunks = <T>(arr: T[], chunkSize = 5): Array<T[]> => {
return arr.reduce(chunkReducerForSize(chunkSize), [[]]);
};

(function sample() {
const fixedSizeData = Array.from(
{ length: Math.floor(Math.random() * 500) + 75 },
(e, i) => (e = Math.floor(Math.random() * 50) + 75)
);
const chunked = toChunks(fixedSizeData);
console.log(chunked);
})();

You can now iterate over the 'rows' for the virtual scroller, and inside 
the 'row', you iterate over the items.

Hope this helps you a bit,
Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to