docs(API): 翻译完了 QueryList

This commit is contained in:
Zhicheng Wang 2018-09-04 16:42:02 +08:00
parent d9a50a8452
commit ee075b2bbd
2 changed files with 26 additions and 1 deletions

View File

@ -78,7 +78,7 @@
[x] | core/ComponentFactoryResolver | 0.20
[x] | forms/Form | 0.20
[x] | common/http/HttpErrorResponse | 0.20
[ ] | core/QueryList | 0.19
[x] | core/QueryList | 0.19
[ ] | forms | 0.19
[ ] | animations/state | 0.19
[ ] | common | 0.19

View File

@ -16,19 +16,32 @@ import {getSymbolIterator} from '../util';
* An unmodifiable list of items that Angular keeps up to date when the state
* of the application changes.
*
* Angular
*
* The type of object that {@link ViewChildren}, {@link ContentChildren}, and {@link QueryList}
* provide.
*
* {@link ViewChildren}{@link ContentChildren} {@link QueryList}
*
* 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="let i of myList"`.
*
* ES6 JavaScript `for (var i of items)` Angular `*ngFor="let i of myList"`
*
* Changes can be observed by subscribing to the changes `Observable`.
*
* `changes` `Observable`
*
* NOTE: In the future this class will implement an `Observable` interface.
*
* `Observable`
*
* @usageNotes
* ### Example
*
* ###
*
* ```typescript
* @Component({...})
* class Container {
@ -50,12 +63,16 @@ export class QueryList<T>/* implements Iterable<T> */ {
/**
* See
* [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
*
* [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[] { return this._results.map(fn); }
/**
* See
* [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
*
* [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[] {
return this._results.filter(fn);
@ -64,6 +81,8 @@ export class QueryList<T>/* implements Iterable<T> */ {
/**
* See
* [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
*
* [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 {
return this._results.find(fn);
@ -72,6 +91,8 @@ export class QueryList<T>/* implements Iterable<T> */ {
/**
* See
* [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
*
* [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 {
return this._results.reduce(fn, init);
@ -80,12 +101,16 @@ export class QueryList<T>/* implements Iterable<T> */ {
/**
* See
* [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
*
* [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 { this._results.forEach(fn); }
/**
* See
* [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
*
* [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 {
return this._results.some(fn);