[英]How to select the nth child with ng-content in angular
我希望能夠根據他們的位置選擇孩子。 例如:
<ul>
<li>
<ng-content select=":nth-child(1)"></ng-content>
</li>
<li>
<ng-content select=":nth-child(2)"></ng-content>
</li>
</ul>
可能嗎?
使用結構指令ngFor,然后使用索引
<ul>
<li *ngFor="let item of items; let i = index">
{{i}} {{item}}
</li>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.