For a practical example, we will reuse the same CRUD sample implementation from the section CRUD sample implementation with DataTable. Start off by adding the ngrx dependencies for a Redux-based application:
npm install @ngrx/store @ngrx/core --save
First of all, we need to define a shape for the store. In real applications, most likely available employees and currently selected employee might be shared across several components. Hence the store could be defined as follows:
export interface AppStore { employees: Employee[]; selectedEmployee: Employee;}
Next, we need to define actions which consist of types and optional payloads.