Hello. I want to destroy component but it says 'Property 'getAnnualDays$' has no initializer and is not definitely assigned in the constructor.'
In Ts I have:
data: User[] = []
displayedColumns: string[] = ['annualDays','annualDaysTaken', 'annualDaysRemaining','reportedAnnualDays',
'casualDaysTaken','casualDaysRemaining','casualDays', 'year'];
getAnnualDays$: Subscription;
constructor(private backendApiService: BackendApiService) {}
ngOnInit() {
const getAnnualDays$ = this.backendApiService.getAnnualDays(2022).subscribe((value) => {
this.data = value as any;
return this.data.values()
})
}
ngOnDestroy() {
this.getAnnualDays$.unsubscribe();
}
}```
How should it be? Thank you