Array properties in Angular template
You can also output arrays in markup. Let's see in practice. Let's say we have the following array:
export class AppComponent {
public arr: string[] = ['a', 'b', 'c'];
}
Let's display the contents of our array in the layout:
<div>
{{ arr[0] }}
{{ arr[1] }}
{{ arr[2] }}
</div>
The following array is given:
export class AppComponent {
public arr: number[] = [1, 2, 3, 4, 5];
}
Print each element of this array in a separate paragraph.