87 lines
2.1 KiB
TypeScript
87 lines
2.1 KiB
TypeScript
import {
|
|
Component,
|
|
ElementRef,
|
|
OnDestroy,
|
|
OnInit,
|
|
ViewChild,
|
|
ViewEncapsulation,
|
|
AfterViewInit
|
|
} from '@angular/core';
|
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
|
import { MatPaginator } from '@angular/material/paginator';
|
|
import { MatSort } from '@angular/material/sort';
|
|
|
|
import { Subject } from 'rxjs';
|
|
import { takeUntil } from 'rxjs/operators';
|
|
|
|
import { fuseAnimations } from 'src/@fuse/animations';
|
|
import { FreeBoardDataSource } from './free-board-list.data-source';
|
|
import { FreeBoardService } from 'src/modules/infos/service/free-board.service';
|
|
|
|
@Component({
|
|
selector: 'app-free-board-list',
|
|
templateUrl: './free-board-list.component.html',
|
|
styleUrls: ['./free-board-list.component.scss'],
|
|
encapsulation: ViewEncapsulation.None,
|
|
animations: fuseAnimations
|
|
})
|
|
export class FreeBoardListComponent
|
|
implements OnInit, OnDestroy, AfterViewInit {
|
|
dataSource: FreeBoardDataSource | null;
|
|
|
|
displayedColumns = [
|
|
'idx',
|
|
'title',
|
|
'contents',
|
|
'createdBy',
|
|
'createdAt',
|
|
'contactStatus',
|
|
'removeBtn'
|
|
];
|
|
private unsubscribeAll: Subject<any>;
|
|
|
|
@ViewChild(MatPaginator, { static: true })
|
|
paginator: MatPaginator;
|
|
|
|
@ViewChild('filter', { static: true })
|
|
filter: ElementRef;
|
|
|
|
@ViewChild(MatSort, { static: true })
|
|
sort: MatSort;
|
|
|
|
constructor(
|
|
private fb: FormBuilder,
|
|
private freeBoardService: FreeBoardService
|
|
) {
|
|
// Set the private defaults
|
|
this.unsubscribeAll = new Subject();
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------------------------------
|
|
// @ Lifecycle hooks
|
|
// -----------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
* On init
|
|
*/
|
|
ngOnInit(): void {
|
|
// Subscribe to update order on changes
|
|
this.dataSource = new FreeBoardDataSource(
|
|
this.freeBoardService,
|
|
this.paginator,
|
|
this.sort
|
|
);
|
|
}
|
|
|
|
/**
|
|
* On destroy
|
|
*/
|
|
ngOnDestroy(): void {
|
|
// Unsubscribe from all subscriptions
|
|
this.unsubscribeAll.next();
|
|
this.unsubscribeAll.complete();
|
|
}
|
|
|
|
ngAfterViewInit(): void {}
|
|
}
|