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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.