Angular 22 cheatsheet
Angular 22: Angular CLI
12 common Angular 22 tasks.
Serve and open the browser
Start the dev server on a given port and open the browser.
ng serve --port 4300 --open
Generate a component
Create a component with its template, styles and test.
ng generate component users/user-card
Preview what a generator creates
List the files without writing anything.
ng generate component users/user-card --dry-run
Generate other building blocks
Generate a route guard, pipe, directive or interface.
ng generate guard auth
ng generate pipe truncate
ng generate directive highlight
ng generate interface user
Add a library
Install a package and run its setup, for example Angular Material.
ng add @angular/material
Update Angular
List available updates, then update the core packages.
ng update
ng update @angular/core @angular/cli