Deleting users

The last piece of supporting CRUD is the ability to remove users from the list. This case is very similar to all the other cases:

  • We need to add support for it to app.component.ts
  • We need to update the reducer, and the reducer needs to call the appropriate adapter method

Let's start with the component and add support in the markup, as well as adding a remove() method  to the component class, like so:

// app.component.ts - adding remove capabilityimport { Component } from "@angular/core";import { AppState } from "./app-state";import { Store } from "@ngrx/store";import { map } from "rxjs/operators";@Component({  selector: "app-root",  template: `  <div style="border: solid 1px black; padding: 10px;"        *ngFor="let user of users$ ...

Get Architecting Angular Applications with Redux, RxJS, and NgRx 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.