Example Application

In this chapter, you'll be creating a simple counter application using @ngrx. Your app will allow users to increment and decrement a number by one, as well as reset that value back to zero. Here's the AppState that we'll be using throughout the example:

app/models/appState.ts

  1. import {Counter} from './counter';
  2. export interface AppState {
  3. readonly counter: Counter;
  4. }

app/models/counter.ts

  1. export interface Counter {
  2. readonly currentValue: number;
  3. }
It's good practice to declare each interface in its own file, and create alogical directory structure if you have seven or more interfaces used by yourapplication.

原文: https://angular-2-training-book.rangle.io/handout/state-management/ngrx/example_application.html