2021-05-18 10:47:16 +02:00
|
|
|
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
|
2020-06-18 16:15:26 +02:00
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
import { Subscription } from 'rxjs';
|
2020-04-22 12:56:18 +02:00
|
|
|
|
2020-05-01 19:10:17 +02:00
|
|
|
import { Poll } from '../../core/models/poll.model';
|
2021-05-18 10:47:16 +02:00
|
|
|
import { DOCUMENT } from '@angular/common';
|
2021-05-18 11:21:40 +02:00
|
|
|
import { slideInAnimation } from '../../shared/animations/main';
|
2020-05-01 19:10:17 +02:00
|
|
|
|
2020-04-22 12:56:18 +02:00
|
|
|
@Component({
|
|
|
|
selector: 'app-administration',
|
|
|
|
templateUrl: './administration.component.html',
|
|
|
|
styleUrls: ['./administration.component.scss'],
|
2021-05-18 11:21:40 +02:00
|
|
|
animations: [slideInAnimation],
|
2020-04-22 12:56:18 +02:00
|
|
|
})
|
2020-06-18 16:15:26 +02:00
|
|
|
export class AdministrationComponent implements OnInit, OnDestroy {
|
2021-05-03 12:36:03 +02:00
|
|
|
public poll: Poll;
|
2020-06-18 16:15:26 +02:00
|
|
|
private routeSubscription: Subscription;
|
2020-05-01 19:10:17 +02:00
|
|
|
|
2021-05-18 10:47:16 +02:00
|
|
|
constructor(private route: ActivatedRoute, @Inject(DOCUMENT) private document: any) {}
|
2020-04-22 12:56:18 +02:00
|
|
|
|
2020-06-16 18:40:48 +02:00
|
|
|
ngOnInit(): void {
|
2020-06-18 16:15:26 +02:00
|
|
|
this.routeSubscription = this.route.data.subscribe((data: { poll: Poll }) => {
|
2021-11-12 15:59:44 +01:00
|
|
|
console.log('routeSubscription data', data);
|
2020-06-18 16:15:26 +02:00
|
|
|
if (data.poll) {
|
|
|
|
this.poll = data.poll;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy(): void {
|
|
|
|
if (this.routeSubscription) {
|
|
|
|
this.routeSubscription.unsubscribe();
|
|
|
|
}
|
2020-06-16 18:40:48 +02:00
|
|
|
}
|
2020-04-22 12:56:18 +02:00
|
|
|
}
|