0

I want to keep employee array and page loading status in store state. So my initial state will look like this

const initialState = {
  isLoading: false,
  employees: []
  };

Now i want to use @ngrx/entity for employee instead of array. The documentation only show the demo for using entity with entire state.

How can i use entity for only one property rather than entire state?

If it's not possible what is the alternative for above scenario?

Ravin Singh D
  • 904
  • 10
  • 19

1 Answers1

0

See the docs for an example:

import { EntityState, EntityAdapter, createEntityAdapter } from '@ngrx/entity';

export interface User {
  id: string;
  name: string;
}

export interface State extends EntityState<User> {
  // additional entities state properties
  selectedUserId: number;
}

export const adapter: EntityAdapter<User> = createEntityAdapter<User>();
timdeschryver
  • 14,415
  • 1
  • 19
  • 32