2017-07-26 81 views
0

我有一個數組對象,我想通過多個屬性過濾該數組,並獲得過濾數組對象的長度在我的html角度綁定複選框檢查/取消檢查條件如下圖所示:如何過濾多個屬性的數組,並獲得過濾角度綁定數組長度

myArray=[ 
       {"ID":1,"StatusID":0}, 
       {"ID":2,"StatusID":1}, 
       {"ID":3,"StatusID":0}]; 

<input type="checkbox" ng-checked="myArray|filter:{ID:2}).length==1" /> 

my expected result like 
if (myArray.ID=2 && myArray.StatusID=1).length==1 
then checkbox is checked 
else unchecked 

回答

1
<input type="checkbox" ng-checked="(myArray|filter:{ID:2,StatusID:1}).length==1" />