Menu

Setting Up Angular

Setting Up Angular

Installing Node.js and Angular CLI

Step 1 – Install Node.js

Angular requires Node.js v20 or later. Download and install the latest LTS version from the official Node.js website.

After installation, verify that Node.js and npm are installed correctly by running the following commands:

node -v

npm -v

Example output:

Step 2 – Install Angular CLI

Install Angular CLI globally using npm:

npm install -g @angular/cli

Once the installation is complete, verify it by running:

ng version

Creating Your First Angular Project

Create a new Angular application by running:

ng new my-first-app

Angular CLI will ask you to configure a few project settings.

Share anonymous usage data.

Select No.

Stylesheet system

Select CSS.

Enable Server-Side Rendering (SSR) and Static Site Generation (SSG)

Select No.

Configure AI tools

Select None.

After the project is created successfully, navigate to the project folder:

cd my-first-app

Running Your First Angular Application

Start the Angular development server by running:

ng serve --open

The application automatically opens in your default browser at:

http://localhost:4200

If everything is configured correctly, you'll see the default Angular welcome page.

Tip: The Angular development server automatically watches your project files. Whenever you save a change, the application recompiles and the browser refreshes automatically, allowing you to view updates instantly.