Masīvu īpašības Angular veidnē
Izkārtojumā var arī izvadīt masīvus. Apskatīsim to praksē. Pieņemsim, ka mums ir šāds masīvs:
app/app.component.tsexport class AppComponent {
public arr: string[] = ['a', 'b', 'c'];
}
Izvadīsim mūsu masīva saturu izkārtojumā:
app/app.component.html<div>
{{ arr[0] }}
{{ arr[1] }}
{{ arr[2] }}
</div>
Задание 1
Dots šāds masīvs:
app/app.component.tsexport class AppComponent {
public arr: number[] = [1, 2, 3, 4, 5];
}
Izvadiet katru šī masīva elementu atsevišķā rindkopā.