fruits = [ 'Apple', 'Orange', 'Pear' ];
<ul>
<li *ngFor="#fruit of fruits, #i = index">{{fruit}} - {{i}}</li>
</ul>
Alın tüm kullanabileceğiniz değişkenler ise:
Local Variables for ngFor
NgFor provides several exported values that can be aliased to local variables:indexwill be set to the current loop iteration for each template context.- Item index'i geliyor
firstwill be set to a boolean value indicating whether the item is the first one in the iteration.- Item ilk elemansa true geliyor
lastwill be set to a boolean value indicating whether the item is the last one in the iteration.- Item son elemansa true geliyor
evenwill be set to a boolean value indicating whether this item has an even index.- Item index'i çift ise true geliyor
oddwill be set to a boolean value indicating whether this item has an odd index.- Item index'i tek ise true geliyor
Günün sözü: "Profesyonel yaklaşım fark yaratır." :P :D
Hiç yorum yok:
Yorum Gönder