How can I use NgFor without creating arrays to generate matrix UI pattern

后端 未结 5 1407
无人及你
无人及你 2021-01-12 16:36

I would like to implement UI matrix pattern, which should generate dynamically. By receiving input parameter it should decide what would be UI matrix pattern dimensions: For

5条回答
  •  滥情空心
    2021-01-12 17:18

    You can either create an helper array like shown in Repeat HTML element multiple times using ngFor based on a number using new Array(count).fill(1) and use ngFor to iterate over this array or you can implement your own structural directive like NgFor that doesn't iterate over an array but instead uses a count as input.

提交回复
热议问题