angular loop up to 10 code example
Example 1: how to loop a number in ngfor
//my.component.ts
counter(i: number) {
return new Array(i);
}
//my.component.html
<li *ngFor='let in of counter(5) ;let i = index'>{{i}}</li>
Example 2: angular for loop
let array = [1,2,3];
array.forEach(function (value) {
console.log(value);
});