Angular Cli Cheat Sheet



commands
Angular
npm install -g @angular/cli
ng new <project name>
cd <project name>
ng serve
ng update @angular/cli @angular/core
Angular CLI Cheat Sheet
ng new <project name> # To create a new project
ng serve # To host the project on 4200 port
ng serve --port <port no> --host <host name> # To host application specific host/port
We can use a short alias as well:
ng s --p <port no> --h <hostname>
Some other helpful commands
ng lint # To lint and look for JavaScript errors
ng lint --format stylish # Linting and formatting the output
ng lint --fix # Lint and attempt to fix all the problems
ng build # to build a project in the dist folder
ng build ---target # Target for which we want to build
ng build --prod # To build in production mode
ng test # To run spec files
ng test --codeCoverage --watch=false
ng e2e # To run e2e test cases
ng doc # To look for angular documentation
ng help # To get help on angular cli commands
To change the .angular-cli.json config
ng set # to change properties
# For e.g. ng set default.styleExt scss
# ng set default.styleExt scss -g -- To set in global angular-cli file
Components
ng generate component # To generate new component
ng g c # Short notation to generate component
ng g c --flat # Want to generate folder name as well?
ng g c --inline-template # Want to generate HTML file?
ng g c -it # Short notation
ng g c --inline-style # Want to generate css file?
ng g c -is # Short notation
ng g c --view-encapsulation # View encapsulation stratergy
ng g c -ve # Short notation
ng g c --change-detection # Change detection strategy
ng g c --dry-run # To only report files and don't write them
ng g c -d # Short notation
ng g c -m -d
# Name of module where we need to add component as dependency
Directives and services
ng generate directive # To generate directive
ng g d # short notation
ng g d -d # To only report files and don't write them
ng generate service # To generate service
ng g s # short notation
ng g s -d # To only report files and don't write them
ng g s -m
# Name of module where we need to add service as dependency
Classes, Interface, pipe, and enums
ng generate class # To generate class
ng g cl # short notation
ng generate interface # To generate interface
ng g i # short notation
ng generate pipe # To generate pipe
ng g p # short notation
ng generate enum # To generate enum
ng g e # short notation
Module and Routing
ng generate module # To generate module
ng g m # To short notation
ng g m --skipTests trus -d # To skip generate spec file for the module
ng g m --routing # To generate module with routing file
ng g guard # To generate guard to route
Angular Cli Cheat Sheet

Angular CLI Cheat Sheet ng new # To create a new project ng serve # To host the project on 4200 port ng serve -port -host # To host application specific host/port We can use a short alias as well: ng s -p -h. Angular is a TypeScript based open-source web application framework used in building both web and mobile based applications. In this article, we will go through some of the angular features by explaining some of its core API. You can follow this angular cheat sheet and use in your project. Angular CLI Cheat Sheet by jakblak - Cheatography.com Created Date: 5536Z. Npm install -g @storybook/cli Go to angular project then execute. Adobe photoshop elements 9 download for mac. Sb init Remove angular stories examples; Create a new story. Ng g component test Create story file. Frequently Used Commands in Angular CLI. Here we discuss the frequently used command in angular CLI: 1. The Angular CLI makes it easy for us to create an application, it does a lot of auto configurations to us and provides an up and running Angular Project. On the command line, we can type: ng new application-name. Here ng new my-test-app.

Create Angular App Command Line

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment