Note: If you use Angular 8
In angular 8 @ViewChild is require two argument. before 8 version @ViewChild require only one argument. Please see below code.
Example: @ViewChild
@ViewChild(MatPaginator, {static: false}) paginator: MatPaginator;
you must implements AfterViewInit before use ngAfterViewInit
Example: ngAfterViewInit
@Component({
selector: 'app-list',
templateUrl: './list.component.html',
})
export class ListComponent implements AfterViewInit { // <-- implements here
@ViewChild(MatPaginator, {static: false}) paginator: MatPaginator;
@ViewChild(MatSort, {static: false}) sort: MatSort;
constructor(){}
ngAfterViewInit() {
}
}