【发布时间】:2019-01-26 12:46:05
【问题描述】:
我想在我的 html 代码中显示数组的长度。数组列表包含另一个数组列表,所以我必须在外部数组迭代时显示内部数组列表的长度
这是我的html代码
<div class="col-xs-12 col-sm-4 col-md-3 col-lg-2 cols" *ngFor="let productMapper of printProducts">
<md-card>
<div (click)=" gotoLink(productMapper)">
<div class="text-center img-wrapper">
<img [src]="productMapper.product.imagePath" class="img-responsive" />
</div>
<div class="divider"></div>
<div class="text-center divider_text" title="{{productMapper.product.productName}}">
<span> {{productMapper.product.productName}} </span>
</div>
</div>
<div class="starRatingBlock text-center" (click)="viewComments($event);">
<span class="commentsBlock">
<i class="fa fa-commenting-o" aria-hidden="true"> {{productMapper.surveyData.length}}</i>
</span>
</div>
<md-card>
</div>
我试过了,但没用:{{productMapper.surveyData.length}}
【问题讨论】:
-
它应该可以工作。你确定
productMapper.surveyData是一个数组吗? -
but not working是什么意思? -
surveyData 应该是内部数组。如果是这样,它应该可以工作。请添加更多代码并提供您的数据示例
-
您是否收到错误消息?
标签: angular typescript