29 lines
895 B
TypeScript
29 lines
895 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
import { Section } from '../../core/section';
|
|
|
|
import { SectionListDataSource } from './section-list-datasource';
|
|
|
|
@Component({
|
|
selector: 'app-section-list',
|
|
templateUrl: './section-list.component.html',
|
|
styleUrls: ['./section-list.component.css'],
|
|
})
|
|
export class SectionListComponent implements OnInit {
|
|
list: Section[] = [];
|
|
dataSource: SectionListDataSource = new SectionListDataSource(this.list);
|
|
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
|
displayedColumns = ['name'];
|
|
|
|
constructor(private route: ActivatedRoute) {}
|
|
|
|
ngOnInit() {
|
|
this.route.data.subscribe((value) => {
|
|
const data = value as { list: Section[] };
|
|
this.list = data.list;
|
|
});
|
|
this.dataSource = new SectionListDataSource(this.list);
|
|
}
|
|
}
|