Skip to content

QueryList is not a Iterable #5437

Description

@filipesilva

Trying to use a QueryList in a for ... of loop in typescript yields the following compilation error:

Type 'QueryList<MyHero>' is not an array type or a string type.

Usage example:

@ViewChildren(MyHero) myHeroes: QueryList<MyHero>;
recallAllHeroes(){
  for (let myHero of this.myHeroes) {
    // ...
  }
}

Adding @vsavkin for reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions