Skip to content

groupBy: If property is undefined or null, do not group it together#220

Open
ericjames wants to merge 1 commit intoa8m:masterfrom
ericjames:patch-1
Open

groupBy: If property is undefined or null, do not group it together#220
ericjames wants to merge 1 commit intoa8m:masterfrom
ericjames:patch-1

Conversation

@ericjames
Copy link

Undefined or null implies the property is not set meaning do not group it, it is unique. This uses the key property, prefixed with _$ to assign it a unique placeholder value and then assign the element itself to that value.

Therefore ng-repeat

[
{  "color": "red" },
{  "color": "red" },
{  "color": null }
]

Groups into:

[{
    "red": [{
        "color": "red"
    }, {
        "color": "red"
    }]
}, {
    "_$3": [{
        "color": null
    }]
}]

Undefined or null implies the property is **not set** meaning do not group it, it is unique.  This uses the key property, prefixed with `_$` to assign it a unique placeholder value and then assign the element itself to that value.

Therefore
```
[
{  "color": "red" },
{  "color": "red" },
{  "color": null }
]
```
Groups into:
{
"red": [{ 
"color":"red"
},{ 
"color":"red"
}]
},
{"_$3": [{
"color": null
}]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant