我想过滤json内部数组
这是我的数组
{
"code": "project_create",
"WFID": ["1, "5", "2", "8", "9", "10", "7"]
},
{
"code": "Task_create",
"WFID": ["1", "5", "2", "8", "9"]
},
{
"code": "project_update",
"WFID": ["10", "5", "2", "8", "9"]
},
我想按WFID = 1过滤
我试试这种方式
var saveWorkflowobj = $filter('filter')(tiggers.alltigger, { WFID: WorkFlowID});
答案 0 :(得分:1)
To hide:
$(".phonebox").css("display", "none");
To show:
$(".phonebox").css("display", "block");
angular.module('app', []).controller('ctrl', ['$scope', '$filter', function($scope, $filter) {
$scope.items = [
{
"code": "project_create",
"WFID": ["1", "5", "2", "8", "9", "10", "7"]
},
{
"code": "Task_create",
"WFID": ["1", "5", "2", "8", "9"]
},
{
"code": "project_update",
"WFID": ["10", "5", "2", "8", "9"]
}
];
$scope.result = $filter('filter')($scope.items, {WFID : "1"}, function(a, b){
return a === b;
});
}])