1- import { Component , AfterViewInit , ViewChild } from '@angular/core' ;
1+ import { Component , OnInit , ViewChild } from '@angular/core' ;
22import { HttpClient } from '@angular/common/http' ;
33import { MatPaginator , MatSort , MatTableDataSource } from '@angular/material' ;
44import { Observable } from 'rxjs/Observable' ;
@@ -17,21 +17,21 @@ import {switchMap} from 'rxjs/operators/switchMap';
1717 styleUrls : [ 'table-http-example.css' ] ,
1818 templateUrl : 'table-http-example.html' ,
1919} )
20- export class TableHttpExample implements AfterViewInit {
20+ export class TableHttpExample implements OnInit {
2121 displayedColumns = [ 'created' , 'state' , 'number' , 'title' ] ;
2222 exampleDatabase : ExampleHttpDao | null ;
2323 dataSource = new MatTableDataSource ( ) ;
2424
2525 resultsLength = 0 ;
26- isLoadingResults = false ;
26+ isLoadingResults = true ;
2727 isRateLimitReached = false ;
2828
2929 @ViewChild ( MatPaginator ) paginator : MatPaginator ;
3030 @ViewChild ( MatSort ) sort : MatSort ;
3131
3232 constructor ( private http : HttpClient ) { }
3333
34- ngAfterViewInit ( ) {
34+ ngOnInit ( ) {
3535 this . exampleDatabase = new ExampleHttpDao ( this . http ) ;
3636
3737 // If the user changes the sort order, reset back to the first page.
0 commit comments