Skip to content

Instantly share code, notes, and snippets.

@boniface
Created January 3, 2020 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boniface/d5329acdd76d105300184d2478e53ed2 to your computer and use it in GitHub Desktop.
Save boniface/d5329acdd76d105300184d2478e53ed2 to your computer and use it in GitHub Desktop.
Angular & NGRX Schematics
1) CREATE: SERVICE EXAMPLE
===================================
ng g s roles/services/roles --skipTests -d
2) INTERFACE EXAMPLE:
======================
ng g i roles/models/role model --skipTests -d
3) COMPONENT EXAMPLE
===========================
ng g c roles/components/role --module=/roles/roles.module.ts --skipTests -d
ng g c roles/components/rolespool -m=/roles/roles.module.ts --skipTests -d
===========INSTALL NGRX SCHEMATICS===============
npm install @ngrx/schematics --save-dev
ng add @ngrx/schematics
npm install @ngrx/{store,effects,entity,store-devtools} --save
ng generate @ngrx/schematics:store State --root --module app.module.ts
================GENERATING A FEATURE IN ANGULAR ===================
m=module, f=feature, co=container, en=entity, ef=effects s =--skipTests
ng generate m comment --flat false --routing -d
ng generate f comment/Comment -m comment/comment.module.ts --group --skipTests -d
ng generate co /comment/containers/comment --state ../reducers/comment.reducer.ts --stateInterface State -d
ng generate co /comment/containers/votes --state ../reducers/comment.reducer.ts --stateInterface State --skipTests
ng generate en /comment/model/user/User --reducers ../../reducers/comment.reducer.ts --skipTests -d
ng generate ef /comment/effects/user/User -m comment/comment.module.ts --skipTests -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment