Printing and PDF export are disabled for this content. View it online at Full Stack Learning Simplified.
Angular Setup with the CLI
The Angular CLI scaffolds, runs, builds, and generates code for your project. It's central to the Angular workflow β you'll use it constantly.
Create and run
bash
npm install -g @angular/cli
ng new my-app
cd my-app
ng serveng serve starts a dev server at http://localhost:4200 with live reload on every change.
Generating code
The CLI generates components, services, and more β with the right files, boilerplate, and naming β so you don't create them by hand.
bash
ng generate component product # or: ng g c product
ng g service data # a service
ng g guard auth # a route guard
ng g pipe currency-format # a pipeProject structure
project
my-app/
ββ src/
β ββ main.ts # bootstraps the app
β ββ app/
β β ββ app.component.ts # root component
β β ββ app.config.ts # app-wide providers
β β ββ app.routes.ts # route definitions
β ββ index.html
ββ angular.json # CLI/build configCommon commands
| Command | Does |
|---|---|
ng serve | run the dev server |
ng build | production build |
ng test | run unit tests |
ng generate | scaffold code |
Tip: Let the CLI generate everything β components, services, guards, pipes. It follows Angular conventions and wires files up correctly, saving time and keeping the project consistent.
Free preview. Sign in and subscribe to unlock all 809 lessons across 25 courses.
Free preview Β· Β© 2026 Full Stack Learning Simplified