How does ngfor specify the number of cycles

<div class="hot-img-div">
  <div *ngFor="let i of showmusicList;let id = index" (click)="showList(i.discover_id)">
    <div *ngIf="id>2 === false">
      <img src={{i.discover_pic}} class="hot-music-img" >
      

{{i.discover_title}}

</div> </div> </div>

as far as I think ngfor only loops three times, and then jumps out of the loop after three times. I now use ngif to judge the subscript of index. What else can you do? ask for help

.
Mar.22,2021

if you set it in HTML, you can do this:

let i of showmusicList.slice(0,3)

showmusicList take the first three. This is the idea of data-driven view.

Menu