Cheatography
https://cheatography.com
Creating Projects
ng new <project-name> [options] |
Creates a new angular project in the current directory |
ng init <project-name> [options] |
Creates a new angular project in the current folder |
Options:
--dry-run (Outputs results but does not create the project)
--verbose (Output all the things!!!1!)
--skip-npm (Does not run npm commands after project creation)
--skip-git (Does not initialize the repo as a git repo
--directory (Specify the parent directory when creating the project)
Examples:
ng new MyProject
ng new MyProject --directory c:/Repos/Angular
ng init MyProject --skip-git
Generating Code
ng generate <type> [options] |
Generates code files in your project. Generated files get their own directories by default |
component <path/name> |
Generates a new component at the specified path with the specified name |
directive <path/name> |
Generates a new directive at the specified path with the specified name |
route <route/route-component> |
Generates a route to the named component. The name should be the route used in RouteConfig |
pipe <path/name> |
Generates a pipe with the specified name at the specified path |
service <path/name> |
Generates a new service at the specified path with the specified name |
Options:
--flat (Do not create new files in their own directory)
--route=<route> (Specify the parent route when generating components and routes)
--skip-router-generation (Do not generate the route config for the parent when generating routes)
--default (Specify the route should be the default route)
--lazy (Specify the route is lazy and default to true)
Examples:
ng generate component MyComponent --flat
ng generate service app/services/MyService
Workflow Tasks
ng doc <keyword> |
Searches the keyword in the Angular docs online |
ng format |
Formats the project code using clang-format |
ng test [options] |
Run project unit tests using karma |
ng e2e |
Runs all project end to end tests using protractor |
ng lint |
Runs codelyzer linter on your project |
Options:
--watch (Keep unit tests alive and running)
Examples:
ng test --watch
ng lint
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment