Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH RUST

Angular Get Started


To use Angular, you need npm which is included with Node.js.


Check Node.js

Angular's tooling (the CLI and build tools) runs on Node.js and uses npm to install packages.

Run these to confirm Node.js and npm are installed and on your PATH:

node -v

This prints your installed Node.js version, like:

v20.x.x

Angular works best with the current LTS (Long Term Support) release (18 or 20).

If you get a "command not found" error, install Node.js (visit our Node.js tutorial for details).

You can also check npm:

npm -v

npm is Node's package manager.

This prints your npm version, like:

10.x.x

npm should be automatically installed with Node.js.


Install Angular CLI

The Angular CLI is the official tool to create, build, and serve Angular apps.

The CLI (Command Line Interface) creates projects, runs a dev server, and provides helpful commands.

Install the Angular CLI globally:

npm install -g @angular/cli

Installing it globally makes the ng command available everywhere.

You can also use npx without a global install.

If you hit permission errors, use npx or run your terminal with elevated rights.


REMOVE ADS


Verify Angular CLI

Verify the installation to ensure ng is on your PATH and versions are compatible.

ng version

Displays the Angular CLI, Node.js, and Angular package versions so you can confirm the installation:

Angular CLI: 18.x.x
Node: 20.x.x
Package Manager: npm 10.x.x

PATH is the list of folders your system searches for commands like ng.


Create an Angular Application

Create a project named my-angular-app:

ng new my-angular-app

This creates the project files and folders and installs dependencies.

It may take a few minutes and will ask a few prompts (see recommended choices below).

Recommended choices when prompted:

  • Stylesheet format: CSS (you can change later)
  • Server-side rendering (SSR): No for now (you can add later with ng add @angular/ssr)
  • Other prompts: keep the defaults

If you Use not to install the CLI globally, you can use npx:

npx @angular/cli@latest new my-angular-app

Run the Angular Application

cd my-angular-app
ng serve

cd enters your new project folder.

ng serve starts a local dev server and watches for changes.

The first build can take a minute.

✔ Compiled successfully. ✔ Browser application bundle generation complete.

You can add the --open flag to automatically open the app in your default browser:

ng serve --open

By default the dev server runs on http://localhost:4200.



×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.