35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { Component, OnDestroy, OnInit } from '@angular/core';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
import { Subscription } from 'rxjs';
|
|
|
|
import { Poll } from '../../core/models/poll.model';
|
|
import { ModalService } from '../../core/services/modal.service';
|
|
import { UserService } from '../../core/services/user.service';
|
|
|
|
@Component({
|
|
selector: 'app-administration',
|
|
templateUrl: './administration.component.html',
|
|
styleUrls: ['./administration.component.scss'],
|
|
})
|
|
export class AdministrationComponent implements OnInit, OnDestroy {
|
|
public poll: Poll = new Poll();
|
|
private routeSubscription: Subscription;
|
|
|
|
constructor(private route: ActivatedRoute, private userService: UserService, private modalService: ModalService) {}
|
|
|
|
ngOnInit(): void {
|
|
this.routeSubscription = this.route.data.subscribe((data: { poll: Poll }) => {
|
|
console.log('data', data);
|
|
if (data.poll) {
|
|
this.poll = data.poll;
|
|
}
|
|
});
|
|
}
|
|
|
|
ngOnDestroy(): void {
|
|
if (this.routeSubscription) {
|
|
this.routeSubscription.unsubscribe();
|
|
}
|
|
}
|
|
}
|