You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
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(); |
|
} |
|
} |
|
}
|
|
|