We have learnt by now that to select data in NgRx, we need to inject the store service and call select on it, either with a string as an argument or with a function. Let's inject the store service and have a look at the state that comes back:
// app.component.ts - a first draftimport { Component } from "@angular/core";import { AppState } from "./app-state";import { Store } from "@ngrx/store";@Component({ selector: "app-root", template: ` User list view`})export class AppComponent { title = "app"; users$; constructor(private store: Store<AppState>) { this.users$ = this.store .select(state => state); this.users$ .subscribe(data => console.log("users", data)); }}
The preceding component won't display the users in a neat list ...