Angular
Basic Commands
Install Angular CLI globally
npm install -g @angular/cli
Create a new Angular project
ng new <project_name>
Serve the Angular application
ng serve
Build the Angular project
ng build
Run end-to-end tests
ng e2e
Run unit tests
ng test
Generate Components & Modules
Generate a new component
ng generate component <component_name>
Generate a new module
ng generate module <module_name>
Generate a new service
ng generate service <service_name>
Generate a new directive
ng generate directive <directive_name>
Generate a new pipe
ng generate pipe <pipe_name>
Generate a new class
ng generate class <class_name>
Generate a new guard
ng generate guard <guard_name>
Routing & Lazy Loading
Generate a routing module
ng generate module <module_name> --routing
Add lazy loading to a module
ng generate module <module_name> --route <route_path> --module app.module
Project Management
Lint the project
ng lint
Format the project code
npm run prettier
Update Angular to the latest version
ng update @angular/cli @angular/core
Analyze the bundle size
ng build --stats-json
Miscellaneous
Check Angular version
ng version
Help with Angular commands
ng help
Last modified: 08 September 2024