Chapter 01

What is Angular, and when should you use it?

Angular is a complete application framework for building single-page web applications. Not a view library with an ecosystem bolted on — routing, forms, HTTP, testing and the build system all ship together and are versioned together.

⏱ 13 min readLevel: beginnerAngular 18

What a single-page application actually is

In a traditional web application every click is a round trip: the browser requests a URL, the server renders HTML, the page reloads, all JavaScript state is lost.

In a single-page application the browser downloads the application once. After that, clicks are handled in JavaScript: the framework swaps out part of the DOM, updates the URL through the History API, and fetches only data — JSON — from the server.

Server-rendered (Thymeleaf, Rails)Single-page (Angular)
First loadFast — HTML arrives readySlower — must download the app
Subsequent navigationFull page reloadInstant — no round trip for markup
Server payload per clickWhole pageJust JSON
Offline / optimistic UINot really possibleNatural
SEOFreeNeeds SSR (chapter 12)
ComplexityOne codebaseTwo codebases, two deployments
Best forContent sites, simple CRUDDashboards, tools people use all day
A SPA is not automatically the right answer

If your application is mostly reading content, or is ten forms behind a login that nobody uses for more than five minutes, a server-rendered page will be simpler, faster to build, and faster to load. Reach for Angular when the interface is the product — rich interaction, live updates, complex forms, lots of client-side state.

What Angular gives you in the box

ConcernAngularTypical React equivalent
Components & renderingBuilt inReact
Routing@angular/routerReact Router (third party)
HTTPHttpClientfetch / axios / TanStack Query
Forms & validationReactive FormsReact Hook Form / Formik
StateSignalsRedux / Zustand / Jotai
Build & dev serverAngular CLIVite / Next.js
TestingTestBed + KarmaJest + Testing Library
Upgradesng update with automated migrationsCoordinate each library yourself

That table is the argument, in both directions. Angular decides for you, which means less freedom and far fewer decisions to relitigate every eighteen months. Two Angular codebases written by different teams look broadly the same; two React codebases frequently do not.

Angular vs React vs Vue, honestly

AngularReactVue
TypeFrameworkLibraryProgressive framework
LanguageTypeScript, alwaysJS or TSJS or TS
Learning curveSteeper start, flat laterGentle start, steep ecosystemGentlest
OpinionsMany — and consistentFewSome
TemplatesHTML + syntaxJSXHTML + syntax
ReactivitySignalsRe-render + hooksSignals (refs)
Bundle (hello world)~120 KB~45 KB + libraries~60 KB
Hiring poolLarge, enterprise-heavyLargestSmaller in the West
Sweet spotLong-lived business apps, big teamsAnything, with decisionsSmall to mid apps, fast delivery
The deciding question

Ask how long the application will live and how many people will touch it. For a five-year internal platform maintained by rotating teams, Angular's uniformity is worth real money. For a marketing site or a two-month prototype, it is overhead. The Stack section argues this case in full.

The architecture

Four layers: browser and routing, standalone components with templates and signals, services and dependency injection, HttpClient with interceptors and the backend
Four layers. Nearly everything you write lives in layer 2 or layer 3.
Building blockResponsibility
ComponentA piece of UI: a template, some state, and the logic that connects them.
TemplateHTML plus Angular syntax — bindings and control flow.
SignalA reactive value. Reading one inside a template creates a dependency.
ServiceLogic and state that is not tied to one component — HTTP, shared state, business rules.
Dependency injectionSupplies services to whatever asks for them; the seam that makes testing easy.
RouterMaps URLs to components, guards access, and lazily loads code.
DirectiveBehaviour attached to an element without a template of its own.
PipeA pure transformation used in templates — {{ total | currency }}.

A first look at the code

order-list.component.ts
import { Component, computed, inject, signal } from '@angular/core';
import { CurrencyPipe } from '@angular/common';
import { OrderService } from './order.service';

@Component({
  selector: 'app-order-list',
  standalone: true,                       // no NgModule needed
  imports: [CurrencyPipe],                // what this template uses
  template: `
    <input [value]="query()" (input)="query.set($any($event.target).value)"
           placeholder="Filter by reference">

    <p>{{ visible().length }} of {{ orders().length }} orders</p>

    @if (loading()) {
      <p>Loading…</p>
    } @else {
      <table>
        @for (order of visible(); track order.id) {
          <tr>
            <td>{{ order.reference }}</td>
            <td>{{ order.total | currency:'EUR' }}</td>
          </tr>
        } @empty {
          <tr><td colspan="2">Nothing matches “{{ query() }}”.</td></tr>
        }
      </table>
    }
  `,
})
export class OrderListComponent {
  private readonly service = inject(OrderService);

  readonly orders  = this.service.orders;     // a signal
  readonly loading = this.service.loading;    // a signal
  readonly query   = signal('');

  readonly visible = computed(() =>
    this.orders().filter(o => o.reference.includes(this.query())));
}

Five things in that snippet define modern Angular:

  1. standalone: trueThe component declares its own dependencies. No module registry to keep in sync.
  2. @if / @for / @emptyBuilt-in control flow. No CommonModule import, better type narrowing, and an empty state without a second @if.
  3. track is mandatoryThe compiler forces you to say how list items are identified, which removes a whole category of rendering bugs.
  4. inject()Works in field initialisers, so no constructor boilerplate.
  5. Signals everywhereCalling query.set(...) updates exactly the bindings that read it — nothing else is re-checked.

A short history (so old code makes sense)

VersionYearWhat changed
AngularJS 1.x2010A different framework entirely. $scope, two-way binding, no relation to modern Angular beyond the name.
Angular 22016Complete rewrite in TypeScript. Components, DI, RxJS.
Angular 92020Ivy renderer — smaller bundles, better errors.
Angular 14–152022Standalone components, typed forms, functional guards.
Angular 16–172023Signals, new control flow, @defer, new docs at angular.dev.
Angular 18–192024–25Zoneless change detection, signal inputs/outputs, httpResource.

"Angular" and "AngularJS" are not the same product. If a Stack Overflow answer mentions $scope or ng-controller, it is AngularJS and irrelevant to you.

Where Angular is genuinely weaker

  • Initial bundle size. A trivial app is bigger than the React equivalent. Irrelevant for an internal tool, relevant for a public landing page.
  • Learning curve. Dependency injection, RxJS and the template syntax are three distinct things to absorb before you are productive.
  • Verbosity. More files and more ceremony than Vue or Svelte for the same screen.
  • The docs churn. Because the framework moved fast recently, search results are full of superseded patterns.

Which statement about modern Angular is false?

Angular 2+ was a complete rewrite with no shared API surface. AngularJS concepts — $scope, ng-controller, dirty-checking digest cycles — do not exist in modern Angular.