docs(common): update ngFor docs to new `as` syntax (#15166)
This commit is contained in:
parent
26f6bd4d3b
commit
9319b5f329
|
@ -45,7 +45,7 @@ export class NgForOfContext<T> {
|
|||
* - `odd: boolean`: True when the item has an odd index in the iterable.
|
||||
*
|
||||
* ```
|
||||
* <li *ngFor="let user of userObservable | async as users; indexes as i; first as isFirst">
|
||||
* <li *ngFor="let user of userObservable | async as users; index as i; first as isFirst">
|
||||
* {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
|
||||
* </li>
|
||||
* ```
|
||||
|
@ -78,8 +78,8 @@ export class NgForOfContext<T> {
|
|||
*
|
||||
* ### Syntax
|
||||
*
|
||||
* - `<li *ngFor="let item of items; let i = index; trackBy: trackByFn">...</li>`
|
||||
* - `<li template="ngFor let item of items; let i = index; trackBy: trackByFn">...</li>`
|
||||
* - `<li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>`
|
||||
* - `<li template="ngFor let item of items; index as i; trackBy: trackByFn">...</li>`
|
||||
*
|
||||
* With `<ng-template>` element:
|
||||
*
|
||||
|
|
|
@ -16,7 +16,7 @@ import {FormArray, FormControl, FormGroup} from '@angular/forms';
|
|||
template: `
|
||||
<form [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<div formArrayName="cities">
|
||||
<div *ngFor="let city of cities.controls; let i=index">
|
||||
<div *ngFor="let city of cities.controls; index as i">
|
||||
<input [formControlName]="i" placeholder="City">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -34,7 +34,7 @@ export const FormErrorExamples = {
|
|||
formArrayName: `
|
||||
<div [formGroup]="myGroup">
|
||||
<div formArrayName="cities">
|
||||
<div *ngFor="let city of cityArray.controls; let i=index">
|
||||
<div *ngFor="let city of cityArray.controls; index as i">
|
||||
<input [formControlName]="i">
|
||||
</div>
|
||||
</div>
|
||||
|
@ -61,4 +61,3 @@ export const FormErrorExamples = {
|
|||
</div>
|
||||
`
|
||||
};
|
||||
|
Loading…
Reference in New Issue