Angular13: Error: Property 'description' comes from an index signature, so it must be accessed with ['description']

Viewed 1693

I'm trying to fix this error in Angular 13: Property 'description' comes from an index signature, so it must be accessed with ['description']. But without success... can anyone help me and explain how to fix?

This is my *.component.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();
    }

}

And this is my *.component.html

<div class="list-group mt-3">
    <a *ngFor="let post of posts" [routerLink]="post.route" class="list-group-item
    list-group-item-action">
        <div class="d-flex w-100 justify-content-between">
            <h5 class="mb-1">{{post.title}}</h5>
        </div>
        <p class="mb-1">{{post.description}}</p>
    </a>
</div>

0 Answers
Related