I want to be able to select the children by their position. For example:
<ul>
<li>
<ng-content select=":nth-child(1)"></ng-content>
</li>
<li>
<ng-content select=":nth-child(2)"></ng-content>
</li>
</ul>
Is it possible?
Use structural directive ngFor and then work with index
<ul>
<li *ngFor="let item of items; let i = index">
{{i}} {{item}}
</li>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.