使用ngFor时删除最后一项后的分隔符

bin*_*ars 4 ionic-framework angular

我正在使用此代码显示多个位置:

<div class="location" *ngFor="let item of location_array">
   {{item}} <hr>
</div>
Run Code Online (Sandbox Code Playgroud)

这导致所有位置,由水平规则分隔.我如何编辑它以获得完全相同的结果,但没有最后的水平规则?

Fai*_*sal 12

使用last由提供*ngFor*ngIf<hr>:

<div class="location" *ngFor="let item of location_array; let lastItem = last;">
   {{item}} <hr *ngIf="!lastItem">
</div>
Run Code Online (Sandbox Code Playgroud)

这是一个StackBlitz演示.