import { Component } from '@angular/core' ; @ Component ( { selector : 'app' , templateUrl : './app.component.html' , styleUrls : [ './app.component.css' ] } ) export class AppComponent { people : ReadonlyArray < Person > = [ ] ; loading : boolean = false ; total : number = 250 ; private _page : number = 0 ; /**
     * Simulate the server request
     */ loadPage ( ) { if ( this . loading || this . _page >= 5 ) { return ; } this . loading = true ; setTimeout ( ( ) => { this . people = [ ... this . people , ... this . getPeople ( this . _page ++ , 50 ) ] ; this . loading = false ; } , 2000 ) ; } /**
     * Generate some data about people
     */ private getPeople ( page , count ) { const people = [ ] ; for ( let idx = page * count ; idx < ( page * count ) + count ; idx ++ ) { people . push ( { id : idx , name : chance . name ( ) , address : chance . address ( ) , phone : chance . phone ( ) , active : chance . bool ( ) } ) ; } return people ; } } interface Person { id : number ; name : string ; address : string ; phone : string ; active : boolean ; }