我正在从后端请求位置列表并将其用于ngFor
但是我想删除第一个数组元素。
说我要删除Id:0
所以在我看来不会这样li
元素。这是我正在渲染并想要删除的列表数组StoreHouse
[
{
'Id': 0,
'StoreLocation': 'StoreHouse'
},
{
'Id': 1,
'StoreLocation': 'Eastleigh'
},
{
'Id': 2,
'StoreLocation': 'Portchester'
},
{
'Id': 3,
'StoreLocation': 'Soho'
},
{
'Id': 4,
'StoreLocation': 'Basingstoke'
}
];
有没有办法不渲染Id:0
in li
当做ngFor
?
Plunker https://plnkr.co/edit/hjZtql97kU8rMVosFhOj?p=preview
您可以使用片管 https://angular.io/docs/ts/latest/api/common/index/SlicePipe-pipe.html:
<li *ngFor="#data of lengthArray | slice:1">
//content
</li>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)