Reader Stacks

What Is Angular and How Do You Install It?

Angular is a complete, opinionated front-end framework — components, routing, forms, and HTTP all come built in, unlike a smaller library you assemble a stack around.

What Is Angular and How Do You Install It?

Angular is a complete, opinionated front-end framework maintained by Google — unlike a smaller UI library, it ships with routing, forms, HTTP handling, dependency injection, and a CLI all built in and designed to work together, rather than requiring you to assemble your own stack from separate packages.

What makes Angular a framework rather than a library

A framework provides the overall structure and calls your code (you fit your components into Angular's lifecycle and module system), whereas a library is something your own code calls when needed — Angular's components, services, modules, and dependency injection system are all part of one integrated, prescribed way of building an application.

Installing Node.js first

Angular's CLI runs on Node.js, so a current LTS version of Node (and its bundled npm) needs to be installed before Angular itself — checking Angular's current documentation for the specific Node version range a given Angular release requires avoids a compatibility mismatch.

Installing the Angular CLI

npm install -g @angular/cli

Creating a new project

ng new my-app

The CLI prompts for a few setup choices (routing, stylesheet format) and then scaffolds a complete, working project structure — components, modules, testing configuration, and build tooling all pre-wired.

Running the development server

cd my-app
ng serve

This starts a local dev server (by default at localhost:4200) with live reload — changes to your source files rebuild and refresh the browser automatically.

The CLI's role beyond project creation

ng generate component user-profile
ng generate service auth
ng build --configuration production

The same ng CLI that scaffolds a new project also generates individual components and services with the correct file structure and boilerplate, and handles production builds — it remains the primary tool you interact with throughout an Angular project's life, not just at setup.

Standalone components (Angular 14+)

More recent Angular versions support standalone components that don't need to be declared in an NgModule — reducing the amount of module boilerplate a small project needs, though the traditional module-based structure remains fully supported and common in existing codebases.

Why Angular's opinionated structure is a genuine trade-off, not just overhead

The upfront learning curve of modules, dependency injection, and the CLI's conventions is real, but it pays off on a larger team or a longer-lived application — everyone on the team builds things the same prescribed way, rather than each contributor assembling their own preferred combination of smaller libraries, which tends to fragment a codebase's structure over time.