在Angular 16(及更早版本)中,可以在for循环后面使用"as"来将过滤后的结果声明为变量.
这样:
<div *ngFor="let item of (items | pipe: Query) as results">
{{item}}
</div>
如何在angular 17中实现这一目标?
我已经try 过使用了
@for (let item of (items | pipe: Query) as results; track item.id) {
<div>
{{item}}
</div>
}
但这并不起作用. 我希望能够使用我的过滤结果并将它们存储在物品数组中.
这可能吗?如有任何帮助,我们将不胜感激!