Complete the code to render each item in the list using *ngFor.
<ul> <li *ngFor="let item [1] items">{{item}}</li> </ul>
The *ngFor directive uses of to loop over the list items.
Complete the code to get the index of each item in the list.
<ul> <li *ngFor="let item of items; [1] = index">{{index}} - {{item}}</li> </ul>
Use let index = index to get the current index in the loop.
Fix the error in the *ngFor syntax to correctly loop over the list.
<div *ngFor="let item [1] items; let idx = index"> {{idx}}: {{item}} </div>
The correct keyword to loop over a list in Angular's *ngFor is of.
Fill both blanks to display the first and last item flags in the list.
<ul> <li *ngFor="let item of items; let first = [1]; let last = [2]"> {{item}} <span *ngIf="first">(First)</span><span *ngIf="last">(Last)</span> </li> </ul>
Use let first = first and let last = last to get flags for first and last items.
Fill all three blanks to create a dictionary of item indexes and values for items longer than 3 characters.
const result = {
[1]: [2] for (let [3] = 0; [3] < items.length; [3]++) {
if (items[[3]].length > 3) {
[[3]]: items[[3]]
}
}
};Use index and value as keys and values, and i as the loop variable.
