What is Angular?

Angular is a framework (a complete kit for building web applications) from Google. It is written in TypeScript, which is JavaScript plus types that say what…

One pancake cart can be run by one person in their own way. Once Jali's Pancake Stall opens branches in many places, the way of working has to be the same. Every branch uses the same pan, the same recipe and the same order of work. So a new worker from any branch knows right away where the batter is kept and what the steps are.

Angular is a framework made by Google for building web applications, written in TypeScript (a language built on JavaScript). A framework is a complete kit. It covers how to build components (pieces of the interface), how to move between pages (routing), and forms. It also covers fetching data over HTTP from a server (a computer that keeps the app's data) and testing (checking code automatically). Angular also brings rules about where each thing goes, like the rules that are the same in every branch of Jali's Pancake Stall. Every Angular project has the same file layout and the same tools. So a developer who moves to another team knows which file to open, like a worker who moves to another branch.

Throughout this track we build Jali's Pancake Stall's delivery order page, step by step. In this lesson you get its first page on screen.

What Angular is, and what it isn't

let price: number = 9
price = 'cheap' // error: Type 'string' is not assignable to type 'number'.

Making a first project with the Angular CLI

The Angular CLI is a command-line tool called ng: you type its commands in the terminal. With ng you create an Angular project, run it and build it (turn the project's code into files the browser can load). In this example, npm installs packages, cd moves into the project folder, and the text after # is only a note:

npm install -g @angular/cli   # install the CLI, once is enough
ng new jalis-pancakes     # create a new project in the folder jalis-pancakes
cd jalis-pancakes
ng serve                      # run the development server

Three files that work together

Of all the files ng new creates, these three files put the page on screen:

<!-- src/index.html -->
<body>
  <app-root></app-root>
</body>
// src/main.ts
import { bootstrapApplication } from '@angular/platform-browser'
import { App } from './app/app'

bootstrapApplication(App)
// src/app/app.ts
import { Component } from '@angular/core'

@Component({
  selector: 'app-root',
  standalone: true,
  template: `<h1>Jali's Pancake Stall</h1>`,
})
export class App {}

Projects from ng new version 20 and later name the class App in the file app.ts. Earlier versions name it AppComponent in app.component.ts. The exercises here use the old name, AppComponent. Both names work.

From index.html to a page on screen

Before you look at the table, guess. The page is on screen with a big heading "Jali's Pancake Stall". Then you right-click and choose View Page Source, the browser menu that shows the HTML the server sent. There, does the <app-root> tag hold that heading, or is it empty?

Step What happens Inside <app-root>
1 The browser loads index.html empty
2 The browser runs the JavaScript built from main.ts empty
3 bootstrapApplication(App) reads the selector app-root, then looks for that tag empty
4 Angular places the App template inside that tag <h1>Jali's Pancake Stall</h1>

View Page Source shows index.html exactly as the server sent it, before any JavaScript ran. So there, <app-root> is empty. The heading exists only in the DOM, which is the set of elements now on the page that JavaScript can change. You can see the DOM in the Elements tab of DevTools (the developer panel in the browser).

If the selector doesn't match the tag in index.html, for example you write selector: 'app-pancake', step 3 fails. The page stays white, and the console in DevTools writes this error:

NG05104: The selector "app-pancake" did not match any elements. Find more at https://angular.dev/errors/NG05104

⚠️ What stops the first page from appearing

🤔 When to choose Angular

Angular fits large apps that many people work on and that are maintained for years, because every tool is already there and the rules are the same for everyone. For a single promo page, plain HTML and CSS are enough. On a page like that, Angular only adds to the size of the files the browser has to load.

TL;DR: Angular is a framework (a complete kit for building web applications) from Google. It is written in TypeScript, which is JavaScript plus types that say what kind of value something is. Angular is not AngularJS, an old framework whose support has ended. In the terminal (where you type commands), ng new project-name creates a project, and ng serve runs it at http://localhost:4200. Three files put the page on screen. index.html has an empty <app-root> tag. main.ts starts the app with bootstrapApplication(App). app.ts holds the class App with the @Component decorator, a mark that says the class is a component (a piece of the interface). Its selector is app-root, and its template is the HTML placed in that tag. View Page Source (the HTML the server sent) still shows <app-root> empty, because JavaScript fills it. If no tag is found for the selector, error NG05104 appears. Since Angular 19, standalone: true is the default, so the line can be left out, in the exercise editor (Angular 22) too.

⚡ Create a project, then run it

Write:

ng new jalis-pancakes
cd jalis-pancakes
ng serve

Meaning: Angular is a framework from Google: a complete kit for building web applications. ng is its command-line tool, so type these three commands in the terminal. ng new creates a whole project folder, and cd moves into it. ng serve runs that project, and you open it at http://localhost:4200 in the browser. Every time you save a file, the page updates by itself.

⚡ A component is an @Component class

Write:

@Component({
  selector: 'app-root',
  standalone: true,
  template: `<h1>Jali's Pancake Stall</h1>`,
})
export class App {}

Meaning: A component is a piece of the interface. @Component marks the class App (a named block of code) as a component, and standalone: true means the component can be used without registering it in another file. selector is the tag name Angular looks for in index.html, here <app-root>. Angular then places the template inside that tag. If that tag isn't found, the page stays white and the console writes error NG05104.

In the exercise, the <h1> must hold exactly Hello Angular!; capital letters and the exclamation mark are checked too.

⚡ JavaScript fills it in

Guess first: the page's heading is on screen. View Page Source shows the HTML the server sent. There, does <app-root> hold that heading, or is it empty?

Empty. View Page Source shows index.html exactly as the server sent it, before any JavaScript ran. The heading exists only in the DOM (the set of elements now on the page), which the browser's DevTools show in the Elements tab.

Meaning: The browser runs main.ts (turned into JavaScript first), which calls bootstrapApplication(App). Only then does Angular fill the <app-root> tag, which was empty before.

What you will learn