I have a data object like this :
$scope.data = [
{
"name": "1001",
"queue": [
{
"number": "111",
}
]
},
{
"name": "1002",
"queue": [
]
},
{
"name": "1008",
"queue": [
{
"number": "222",
}
]
}]
I'm using angular js. I have first declared 3 arrays:
$scope.a = [];
$scope.b = [];
$scope.c = [];
The desired output that I want :
If I do console.log($scope.a); then the output should be :
{
"name": "1001",
"queue": [
{
"number": "111",
}
]
}
If I do console.log($scope.b); then the output should be :
{
"name": "1008",
"queue": [
{
"number": "222",
}
]
}
If I do console.log($scope.c); then the output should be :
{
"name": "1002",
"queue": [
]
}
I want to go through the data and push the objects where the queue number is 111 into $scope.a, push the objects where the queue number is 222 into $scope.b and push the objects where the queue array is empty into $scope.c. I'm not able to figure how to filter this object by checking the values from the queue array. How do I do it in AngularJS?
$scope.a,$scope.band$scope.c?