0
0
Angularframework~5 mins

Angular CLI installation and setup

Choose your learning style9 modes available
Introduction

Angular CLI helps you start and manage Angular projects easily. It saves time by creating files and configurations automatically.

When you want to create a new Angular project quickly.
When you need to add features like components or services to your app.
When you want to run your Angular app on a local server for testing.
When you want to build your app for production with optimized files.
When you want to generate code following Angular best practices.
Syntax
Angular
npm install -g @angular/cli
ng new project-name
cd project-name
ng serve
Use npm install -g @angular/cli to install Angular CLI globally on your computer.
The ng new command creates a new Angular project folder with all setup done.
Examples
Installs Angular CLI globally so you can use the ng command anywhere.
Angular
npm install -g @angular/cli
Creates a new Angular project named my-app with default settings.
Angular
ng new my-app
Moves into the project folder and starts a local server to run the app.
Angular
cd my-app
ng serve
Sample Program

This sequence installs Angular CLI, creates a new project called hello-world, moves into that folder, and starts the app on a local server.

You can open http://localhost:4200 in your browser to see the running app.

Angular
npm install -g @angular/cli
ng new hello-world
cd hello-world
ng serve
OutputSuccess
Important Notes

Make sure you have Node.js installed before installing Angular CLI.

Use ng serve --open to automatically open the app in your browser.

Angular CLI commands help keep your project organized and follow best practices.

Summary

Angular CLI makes starting and managing Angular projects simple and fast.

Use npm install -g @angular/cli to install it globally.

Create new projects with ng new and run them with ng serve.