Angularテンプレートでの配列プロパティ
マークアップ内でも配列を表示することができます。 実際に見てみましょう。次のような配列があるとします:
app/app.component.tsexport class AppComponent {
public arr: string[] = ['a', 'b', 'c'];
}
マークアップ内で配列の内容を表示してみましょう:
app/app.component.html<div>
{{ arr[0] }}
{{ arr[1] }}
{{ arr[2] }}
</div>
Задание 1
次の配列があります:
app/app.component.tsexport class AppComponent {
public arr: number[] = [1, 2, 3, 4, 5];
}
この配列の各要素を別々の段落で表示してください。