QueryList

export class QueryList

exported from angular2/core defined in angular2/src/core/linker/query_list.ts (line 3)

An unmodifiable list of items that Angular keeps up to date when the state of the application changes.

The type of object that QueryMetadata and ViewQueryMetadata provide.

Implements an iterable interface, therefore it can be used in both ES6 javascript for (var i of items) loops as well as in Angular templates with *ngFor="#i of myList".

Changes can be observed by subscribing to the changes Observable.

NOTE: In the future this class will implement an Observable interface.

Example (live demo)

@Component({...}) class Container { constructor(@Query(Item) items: QueryList<Item>) { items.changes.subscribe(_ => console.log(items.length)); } }

Members

changes : Observable<any>

Not Yet Documented

length : number

Not Yet Documented

first : T

Not Yet Documented

last : T

Not Yet Documented

map(fn: (item: T) => U) : U[]

returns a new array with the passed in function applied to each element.

filter(fn: (item: T) => boolean) : T[]

returns a filtered array.

reduce(fn: (acc: U, item: T) => U, init: U) : U

returns a reduced value.

toArray() : T[]

converts QueryList into an array

toString() : string

Not Yet Documented