AI Hints
Home›Angular Tutorial›The Root Component, ng serve and Your First Change
Angular · Lesson 9 of 120

Your First Change

Make it yours.

⏱ 2 min read▶ Video at 9:51🎓 Free
Watch this lesson in the Angular courseWatch on YouTube ↗Full Angular course

The welcome page is just a placeholder. Let's replace it with our own bookshop page.

  • A placeholder page
  • Replace it
  • Our bookshop

src/app/app.html

We delete everything in app dot html, and write two lines instead. The double curly braces show the value of title. And we call title with brackets, because it's a signal.

app.htmlhtml
<h1>Welcome to {{ title() }}!</h1>
<p>Our bookshop is open.</p>

A new title

In app dot ts, we change the title to, the bookshop. We save the file, and the browser updates by itself. Run it. The page shows our own heading, and text.

app.tstypescript
import { Component, signal } from '@angular/core';
import { RouterOutlet } from '@angular/router';

@Component({
  imports: [RouterOutlet],
  selector: 'app-root',
  styleUrl: './app.css',
  templateUrl: './app.html',
})
export class App {
  protected readonly title = signal('the bookshop');
}
Also uses app.html
<h1>Welcome to {{ title() }}!</h1>
<p>Our bookshop is open.</p>
Also uses app.css

The edit loop

This is how you'll work, every day. Change a file, and save it. Look at the browser. And repeat. Small steps, with a quick look after each one, are the fastest way to learn.

keyvalue
1change a file
2save it
3look at the browser
4repeat, in small steps

Summary

We replaced the welcome page with our own template, and changed the title signal. That's the end of module one. Next, the TypeScript you need for Angular.

Key takeaways
  • app.html
  • {{ title() }}
  • Save and look
Next up: Why TypeScript — JavaScript with types