Sci*_*ion 11 angular2-pipe angular
我有以下模板:
<div *ngFor="let item of myArray | customPipe1 | customPipe2; let l = length">
Here is the length of my ngFor : {{l}}
</div>
Run Code Online (Sandbox Code Playgroud)
不幸的是,ngFor中不存在长度.我如何解决这个问题,以便在我的ngFor中提供长度?
yur*_*zui 14
另一种解决方案可能如下
<div *ngFor="let item of myArray | customPipe1 | customPipe2; let l = count">
Here is the length of my ngFor : {{l}}
</div>
Run Code Online (Sandbox Code Playgroud)
也可以看看
Gün*_*uer 13
<div *ngFor="let item of myArray | customPipe1 | customPipe2 as result">
Here is the length of my ngFor : {{result.length}}
</div>
Run Code Online (Sandbox Code Playgroud)
另见https://angular.io/api/common/NgForOf
| 归档时间: |
|
| 查看次数: |
17396 次 |
| 最近记录: |