ucap-lg-web/src/app/pages/organization/components/index.page.component.ts
Park Byung Eun 23bbfc4b63 0524 sync
2020-05-24 13:46:38 +09:00

59 lines
1.5 KiB
TypeScript

import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Component, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import { QueryParams } from '../types/params.type';
@Component({
selector: 'app-pages-organization-index',
templateUrl: './index.page.component.html',
styleUrls: ['./index.page.component.scss']
})
export class IndexPageComponent implements OnInit, OnDestroy {
// tslint:disable-next-line: variable-name
_searchData: {
companyCode: string;
searchWord: string;
isSearch: boolean;
};
deptSeq: string;
private ngOnDestroySubject: Subject<boolean>;
constructor(
private store: Store<any>,
private activatedRoute: ActivatedRoute,
private changeDetectorRef: ChangeDetectorRef
) {}
ngOnInit(): void {
this.ngOnDestroySubject = new Subject<boolean>();
this.activatedRoute.queryParams
.pipe(takeUntil(this.ngOnDestroySubject))
.subscribe((params) => {
console.log('activatedRoute.queryParams');
if (!!params) {
const companyCode = params[QueryParams.DEPT_SEQ];
console.log('activatedRoute.queryParams', companyCode);
this._searchData = {
companyCode,
searchWord: '',
isSearch: false
};
}
});
}
ngOnDestroy(): void {
if (!!this.ngOnDestroySubject) {
this.ngOnDestroySubject.complete();
}
}
}