Let's say I have an array called users
structured like this:
$scope.users = [
{
"name": "foo",
"status": "pending"
},
{
"name": "bar",
"status": "pending"
},
{
"name": "baz",
"status": "active"
},
{
"name": "qux",
"status": "confirmed"
}
]
My goal is to create a grouped list based on two different status
properties. The desired output would consist of the following two lists:
List 1
pending, confirmed
-> foo, bar, qux
List 2
active
-> baz
Currently, I am using the following code snippet:
ng-repeat="(key, value) in users | groupBy: 'status'"
However, this approach results in three separate groups (confirmed, active, and pending) rather than the required two as mentioned above.
Is there a way to merge the two statuses within this ng-repeat
loop?