CRUD application with @ngrx/store

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.

The best practice is to create Action Creator Services encapsulating associated ...

Get Angular UI Development with PrimeNG now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.