Skip to content

Instantly share code, notes, and snippets.

@aboudard
Created November 30, 2021 13:59
Show Gist options
  • Save aboudard/467dd4c57e80bcb0a4d356b5abf63f44 to your computer and use it in GitHub Desktop.
Save aboudard/467dd4c57e80bcb0a4d356b5abf63f44 to your computer and use it in GitHub Desktop.
NgRx Data filter function
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