简体   繁体   中英

Loading HTML list elements partially

In my Angular4 app I have a list with few thousands of li elements. li elements are showed when user clicks on ul element. Expanding such amount of li's ofcourse is hard time to browser, sometimes it takse few seconds, other time the browser gets stuck.

I am looking for smart way how to load this elements partially. I do not want to use paginantion.

<ul>
   <li *ngFor="let item of filteredData>
   <div></div> //and so on...
   </li>
</ul>

simply do load to some content

<div class="item active" *ngFor="#data of lengthArray;i=index">
    <div *ngIf="i<=4">
        content
    </div>
</div>

or check this out example

<ul>
  <li *ngFor="let person of people">

      <!-- HERE: add a element with click event binding -->
      <a href="#" (click)="selectPerson(person)">
        {{person.name}} 
      </a>

  </li>
</ul>

<app-person-details [person]="selectedPerson"></app-person-details>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM