如何根据数据列表在“ * ngFor”循环中使用过滤器

时间:2019-05-03 11:09:51

标签: filter angular6 pipe

使用以下数据在角度1.5中完成


getdetailAttrList= [
    { getName: "Id", getNumber: "1335626187264778", getString: '10000450439458'},
    { getName: "Pat_Id", getNumber: "1335626196206806", getString: '00350242060011'},
    { getName: "Prov_Id", getNumber: "1335626218309875", getString: '3228610'},
    { getName: "Pat_Name", getNumber: "1335626212804143", getString: '200131'},

];

<tr ng-if="getdetailAttrList.length >= 0" 
ng-repeat="info in getdetailAttrList
| unique:'getName' | filter: { getName: '!UID' } 
| filter: { getName: '!PROVIDERID' }">
   <td class="subj">{{info.getName}}</td>
   <td>{{info.getString}}</td>
</tr>

如何在angular 6中实现相同的功能?

1 个答案:

答案 0 :(得分:0)

在角度6中,您可以通过这种方式循环数据

<tr *ngIf="getdetailAttrList.length >= 0" *ngFor="let info of getdetailAttrList">
 <td class="subj">{{info.getName}}</td>
 <td>{{info.getString}}</td>
</tr>