Skip to content

simontonsoftware/ngrx-example-app-to-ng-app-state

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repo exists to demonstrate ng-app-state, which is an object-oriented wrapper around ngrx/store.

This repo is a fork of ngrx/platform, with its example-app migrated to ng-app-state. master is mostly untouched; instead there are 4 branches migrating different parts of the example, to allow viewing their diffs:

  • Core Module: a very simple module, this demonstrates manipulating the store directly from your components. This is not recommended for more complex interactions, but is a very easy solution in cases like this.
  • Auth Module: a slightly more complex module, this demonstrates going through a service to interact with the store and perform other side effects (in this case, redirecting to the login page).
  • Books Module: the most complex module, this continues the same theme above.
  • The full diff of all 3 modules. This is simply the 3 branches aboved merged into one. It shows the amount of boilerplate that can be removed; the diff is roughly +450/-1000 lines.

Each branch is fully functional, demonstrating that ng-app-state can work side-by-side with custom actions and reducers, as well as ngrx/db, /effects, /store-devtools, and /entity.

The more complex modules follow a general pattern:

  • State definitions are extracted to their own file, with initial values inlined with the definiton itself.
  • A service with traditional methods is used in place of effects and their corresponding reducer.
  • The boilerplate for actions and their type constants are discarded in favor of directly calling methods on the services mentioned above.

Packages

No packages published

Languages

  • TypeScript 96.1%
  • Python 2.3%
  • JavaScript 1.1%
  • Other 0.5%