Angular Get Started

Angular Get Started

Before you can build an Angular application, you need to set up your local development environment.

Angular relies heavily on Node.js and its package manager, NPM.

In this tutorial, we will install the necessary tools and generate our first project.


1. Install Node.js

Angular requires an active, long-term support (LTS) version of Node.js.

You can download and install Node.js directly from nodejs.org.

To verify your installation, open your terminal and run the following command:

Verify Node.js:

node -v
npm -v

2. Install the Angular CLI

The Angular CLI (Command Line Interface) is an essential tool for modern Angular development.

It is used to initialize, develop, scaffold, and test your applications directly from the terminal.

To install the CLI globally on your computer, use the following NPM command:

Install Angular CLI:

# The -g flag installs the package globally across your whole system
npm install -g @angular/cli

3. Create a Workspace and Initial App

Once the CLI is installed, creating a new project takes only a single command.

Navigate to the directory where you want your project to live.

Then, use the ng new command followed by your desired project name.

Generate New Project:

ng new my-first-angular-app

The CLI will prompt you with a few setup questions, like whether you want to include Angular routing.

It will also ask which stylesheet format you prefer (CSS, SCSS, Sass, or Less).

Select "Yes" for routing and "CSS" for styling to keep things simple for now!


What Happens Next?

The ng new command will take a few minutes to complete.

It is downloading massive amounts of boilerplate code and installing all required NPM dependencies.

In the next chapter, we will explore this newly created folder structure and launch the app in the browser!


Exercise 1 of 2

?

What underlying technology must be installed on your computer before you can use the Angular CLI?

Exercise 2 of 2

?

Which CLI command is used to generate a brand new Angular project?