Angular CLI Cheat Sheet

A Programming › AngularJS cheat sheet in English by GregFinzer

Installation of the Angular CLI plus commands

6,406 views 1,330 downloads 27 Sep 2023 History

Instal­lation and Creating a Project

Instal­lation
Creating a Project
Install LTS version of Node: https:­//n­ode­js.org or install with Chocol­atey: choco install nodejs-lts
ng new <pr­­oject name>
Install Angular CLI: npm install -g @angul­ar/cli

Building, Running, and Testing

Building and Running
Testing
ng serve --open
ng lint
ng build
ng test
ng deploy
ng test --watch
 
ng e2e

Generate

ng generate app-shell <na­me>
Generates an applic­ation shell for running a server­-side version of an app.
ng generate applic­ation <na­me>
Generates a new basic applic­ation definition in the "­pro­jec­ts" subfolder of the workspace.
ng generate class <na­me>
Creates a new, generic class definition in the given project.
ng generate component <na­me>
Creates a new, generic component definition in the given project.
ng generate config <na­me>
Generates a config­uration file in the given project.
ng generate directive <na­me>
Creates a new, generic directive definition in the given project.
ng generate enum <na­me>
Generates a new, generic enum definition in the given project.
ng generate enviro­nments <na­me>
Generates and configures enviro­nment files for a project.
ng generate guard <na­me>
Generates a new, generic route guard definition in the given project.
ng generate interc­eptor <na­me>
Creates a new, generic interc­eptor definition in the given project.
ng generate interface <na­me>
Creates a new, generic interface definition in the given project.
ng generate library <na­me>
Creates a new, generic library project in the current workspace.
ng generate module <na­me>
Creates a new, generic NgModule definition in the given project.
ng generate pipe <na­me>
Creates a new, generic pipe definition in the given project.
ng generate resolver <na­me>
Generates a new, generic resolver definition in the given project.
ng generate service <na­me>
Creates a new, generic service definition in the given project.
ng generate servic­e-w­orker <na­me>
Pass this schematic to the "­run­" command to create a service worker
ng generate web-worker <na­me>
Creates a new, generic web worker definition in the given project.

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.