Vlastnosti-pole v šabloně Angular
Ve verštování lze také zobrazovat pole. Podívejme se na praxi. Předpokládejme, že máme následující pole:
app/app.component.tsexport class AppComponent {
public arr: string[] = ['a', 'b', 'c'];
}
Zobrazme obsah našeho pole v verštování:
app/app.component.html<div>
{{ arr[0] }}
{{ arr[1] }}
{{ arr[2] }}
</div>
Задание 1
Je dáno následující pole:
app/app.component.tsexport class AppComponent {
public arr: number[] = [1, 2, 3, 4, 5];
}
Zobrazte každý prvek tohoto pole v samostatném odstavci.