Angular Setup
Before developing Angular applications, we need to prepare the development environment. This includes installing Node.js, Angular CLI and creating our first Angular application.
What is Angular Setup?
Angular requires a development environment where we can create, run, test and build Angular applications.
The basic setup involves installing Node.js, installing Angular CLI, creating an Angular application and running it in the browser.
Angular Setup Flow
Node.js
Install Node.js and npm.
Angular CLI
Install Angular Command Line Interface.
Create App
Create a new Angular application.
Run App
Start the application in browser.
Prerequisites
Node.js
Node.js provides the runtime environment required for Angular development.
npm
npm is used to install and manage Angular packages and dependencies.
Code Editor
Visual Studio Code or another suitable editor can be used to write Angular code.
Check Node.js Installation
After installing Node.js, open Command Prompt or Terminal and check the installed Node.js version.
node --version
You can also check the npm installation:
npm --version
Expected Result
The terminal displays the installed Node.js and npm version information.
npm: [installed-version]
Install Angular CLI
Angular CLI is a command-line tool that helps developers create, develop, test and build Angular applications.
npm install -g @angular/cli
After installation, verify Angular CLI:
ng version
Expected Result
Angular CLI displays information about the Angular CLI, Node.js environment and related Angular packages.
Create Angular Application
Once Angular CLI is installed, we can create a new Angular application using the ng new command.
ng new CIITStudentApp
Angular CLI will ask some configuration questions. Select the options according to your project requirements.
Run Angular Application
Move inside the project folder and start the Angular development server.
cd CIITStudentApp
ng serve
Expected Output
Angular starts the development server and provides a local address where the application can be opened in the browser.
Angular Application Flow
Important Angular Commands
| Command | Purpose |
|---|---|
node --version
|
Check Node.js version |
npm --version
|
Check npm version |
ng version
|
Check Angular CLI information |
ng new ProjectName
|
Create a new Angular application |
ng serve
|
Run Angular development server |
ng generate component name
|
Create an Angular component |
Angular Setup Checklist
Node.js installed
npm available
Angular CLI installed
Angular application created
Angular development server started
Application opened in browser
Summary
Angular setup prepares the development environment required to create Angular applications.
The basic process is Node.js → Angular CLI → Create Application → ng serve → Browser .
In the next topic, we will learn about Node.js and its role in Angular development.