Created
November 30, 2021 13:59
-
-
Save aboudard/467dd4c57e80bcb0a4d356b5abf63f44 to your computer and use it in GitHub Desktop.
NgRx Data filter function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { EntityMetadataMap } from '@ngrx/data'; | |
export function activeFilter(entities: { active: boolean }[], search: boolean) { | |
return entities.filter(e => e.active === search); | |
} | |
const entityMetadata: EntityMetadataMap = { | |
Todo: { | |
filterFn: activeFilter | |
} | |
}; | |
export const entityConfig = { | |
entityMetadata | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment