如何通过Angular填充QueryList?

时间:2017-12-30 10:35:52

标签: angular

我正在研究QueryList类的定义。它包含私有属性QueryList,但没有方法来填充此属性。 angular如何填充export declare class QueryList<T> { private _dirty; private _results; private _emitter; readonly changes: Observable<any>; readonly length: number; readonly first: T; readonly last: T; /** * See * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) */ map<U>(fn: (item: T, index: number, array: T[]) => U): U[]; /** * See * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) */ filter(fn: (item: T, index: number, array: T[]) => boolean): T[]; /** * See * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) */ find(fn: (item: T, index: number, array: T[]) => boolean): T | undefined; /** * See * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) */ reduce<U>(fn: (prevValue: U, curValue: T, curIndex: number, array: T[]) => U, init: U): U; /** * See * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) */ forEach(fn: (item: T, index: number, array: T[]) => void): void; /** * See * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) */ some(fn: (value: T, index: number, array: T[]) => boolean): boolean; toArray(): T[]; toString(): string; reset(res: Array<T | any[]>): void; notifyOnChanges(): void; /** internal */ setDirty(): void; /** internal */ readonly dirty: boolean; /** internal */ destroy(): void; } 类的对象?

声明:

 map<U>(fn: (item: T, index: number, array: T[]) => U): U[]

同样,我对地图的声明感到困惑,过滤...对于地图,只有一行:

color = "red"

当然,map接受一个函数,但这只是签名。它如何知道如何处理参数函数?

我在这里明显缺少Angular的工作原理......

0 个答案:

没有答案