All datasources done. Now to wire them up in the components.

Plus ElementRefs are now optional as they cannot be initialized
This commit is contained in:
2020-11-23 10:25:53 +05:30
parent 39e3cc51bb
commit af343cb7f9
66 changed files with 556 additions and 328 deletions
@@ -13,8 +13,8 @@ import { UserListDataSource } from './user-list-datasource';
styleUrls: ['./user-list.component.css'],
})
export class UserListComponent implements OnInit {
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
@ViewChild(MatSort, { static: true }) sort: MatSort;
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator = undefined;
@ViewChild(MatSort, { static: true }) sort?: MatSort = undefined;
dataSource: UserListDataSource;
list: User[];
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
@@ -23,7 +23,8 @@ export class UserListComponent implements OnInit {
constructor(private route: ActivatedRoute) {}
ngOnInit() {
this.route.data.subscribe((data: { list: User[] }) => {
this.route.data.subscribe((value) => {
const data = value as { list: User[] };
this.list = data.list;
});
this.dataSource = new UserListDataSource(this.paginator, this.sort, this.list);