我的角度 ts 文件出现上述错误。但无法理解修复。任何人帮助我
ts文件:
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ScullyRoute, ScullyRoutesService } from '@scullyio/ng-lib';
import { Subscription } from 'rxjs';
@Component({
selector: 'app-articles',
templateUrl: './articles.component.html',
styleUrls: ['./articles.component.scss']
})
export class ArticlesComponent implements OnInit, OnDestroy {
posts: ScullyRoute[] = [];
private routeSub: Subscription | undefined;
constructor(private scullyService: ScullyRoutesService) { }
ngOnInit(): void {
this.routeSub = this.scullyService.available$.subscribe(posts => {
this.posts = posts.filter(post => post.title);
});
}
ngOnDestroy(): void {
this.routeSub?.unsubscribe();
}
}