I'm moving from ReactJS to Angular 4. I need to loop around some html markup so I don't have to re-type it. Only thing changes with each item is that that I need to generate html attributes e.g ids etc based on the loop index. So basically something like below. How should I handle this in Angular? Don't think I need to to use *ngFor here. I don't have an array of data, just need to loop for a finite number of times. In ReactJS I usually would have a function return the html like this:
const itemCount = 12;
let itemMarkup = [];
for (let i = 1; i <= itemCount; i++) {
itemCount.push(
<div id={`itemi`}>Item i</div>
)
}
return itemMarkup ;
Thanks!
*ngForand create a method that creates a list of indexes to iterate over, such asconst indexes = count => [...Array(count).keys()]