如何在ngFor之外使用*ngFor当前对象?

Kes*_*vid 6 javascript ngfor angular

标题可能看起来很奇怪,但我所说的基本上就是这个链接正在做什么.

林寻找一种方式来使用迭代当前person<tr>了外面*ngFor范围.

在链接他用ng-repeat-startng-repeat-end包括多标签withing的ng-repeat.我如何能实现相同的行为使用withing Angular2 *ngFor

Kes*_*vid 9

我不得不使用<template>标签,这使得迭代对象可以在其中访问.

<template let-person ngFor [ngForOf]="people">
    <tr>
        <td>{{person.name}}</td>
        <td>{{person.gender}}</td>
    </tr>
    <div>
        <span>{{person.details}}</span>
    </div>
</template>
Run Code Online (Sandbox Code Playgroud)

希望它能帮助别人