Your First Angular App
With the CLI installed, generating and running an Angular app takes two commands. Let’s do that now before looking at what was created.
Generate a new app
Section titled “Generate a new app”ng new my-first-appThe CLI will ask a few questions:
? Which stylesheet format would you like to use? CSS? Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? NoChoose CSS for stylesheets and No for SSR. The CLI then:
- Creates the project directory
- Generates the project files
- Runs
npm installto install dependencies
This takes a minute or two on the first run.
Start the dev server
Section titled “Start the dev server”cd my-first-appng serveOutput:
✔ Browser application bundle generation complete.
Initial chunk files | Names | Raw sizemain.js | main | 213.36 kBpolyfills.js | polyfills | 34.01 kBstyles.css | styles | 111 bytes
Build at: 2026-01-01T00:00:00.000Z - Hash: abc123def456
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
✔ Compiled successfully.Open http://localhost:4200 in your browser. You should see the Angular welcome page — a dark themed page with the Angular logo and some links.
That page is a running Angular application. Every time you save a file, the browser will automatically refresh.
What ng new created
Section titled “What ng new created”The project directory contains:
my-first-app/├── src/│ ├── app/│ │ ├── app.component.html ← the root template│ │ ├── app.component.ts ← the root component class│ │ ├── app.component.css ← component styles│ │ ├── app.component.spec.ts ← unit test│ │ ├── app.config.ts ← app-level configuration│ │ └── app.routes.ts ← route definitions│ ├── index.html ← the HTML shell│ └── main.ts ← the entry point├── angular.json ← CLI configuration├── package.json└── tsconfig.jsonThe next lesson covers each of these files in detail. For now, try this: open src/app/app.component.html, delete everything, and replace it with:
<h1>Hello, Angular!</h1>Save the file. Your browser should immediately show “Hello, Angular!” — that is Angular’s live reload in action.
Exercise
Section titled “Exercise”- Run
ng new my-first-appand choose CSS stylesheets, no SSR. - Run
ng serveand open http://localhost:4200. - Open
src/app/app.component.html. Replace the contents with a heading that displays your name. - Confirm the browser updates automatically when you save.
- Open
src/app/app.component.ts. Find thetitleproperty and change its value. Observe that the page still works.
ng new <name>scaffolds a complete Angular project and installs dependencies.ng servestarts the dev server with live reload atlocalhost:4200.- The generated project includes a root component, route configuration, and app-level setup.
- Changes to template files cause the browser to reload automatically.