Ng for is not work

hello, I am just started Angular 4 Beginner to Pro then stuck in Angular exercise.

I want to implement ng Directives in author.component.html like this

*ngFor=“let author of authors”

but then when I run ng serve =>

Error: src/app/authors/authors.component.html:4:26 - error TS2322: Type ‘() => string[]’ is not assignable to type ‘any[] | Iterable | (Iterable & any[]) | (any[] & Iterable) | null | undefined’.
Type ‘() => string[]’ is not assignable to type ‘any[] & Iterable’.
Type ‘() => string[]’ is not assignable to type ‘any[]’.

Can anyone help me ?

export class AuthorComponent implements OnInit {

authors;

constructor(service: AuthorService) {

this.authors = service.getAuthors(5);

}

ngOnInit(): void {}

}

------authors must be an array

1 Like