How to replicate normal for loop to *ngFor

前端 未结 3 1086
隐瞒了意图╮
隐瞒了意图╮ 2021-01-29 13:34
rating = 4;
for(i=0; i < rating ; i++){ 
//print statement
}

how to replicate the same for loop with conditions in angular 6 using *ngFor

th

3条回答
  •  被撕碎了的回忆
    2021-01-29 14:22

    I think you looking for this kind of solution, Just create one empty array with your rating length

    component

    let items = [];
    for(i=0; i < rating ; i++){ 
     items.push(i);
    }
    

    Use in template like

提交回复
热议问题