Once you have installed the Angular CLI, you can quickly spin up a new Angular project with a single command. In this topic, you will:
Hello World message.Think of this as your first “hello” to Angular — a simple starting point before building real-world apps.
ng) – Command-line tool to create, build, and serve Angular apps.ng new <project-name> – Creates a new Angular project with a ready-to-use structure.ng serve – Starts a local development server (default: http://localhost:4200).app.component.ts – The root component where you can display your first Hello World message.src/, src/app/, and files like angular.json, package.json, etc.When you run ng new hello-world-app, Angular CLI generates a standard folder structure:
The root component AppComponent (in src/app/app.component.ts) is what you see first in the browser. By changing its template, you control what appears on the page.
Run this command in your terminal to create a new project named hello-world-app:
// Create a new Angular project named "hello-world-app"
ng new hello-world-app
This will create a new Angular project with all necessary configurations.
Navigate into the project directory and start the development server:
// Go into the project folder and start the dev server
cd hello-world-app
ng serve
Open your browser and go to http://localhost:4200. You should see the default Angular welcome page.
Edit the main component file src/app/app.component.ts to show a custom Hello World message:
// src/app/app.component.ts — simple Hello World component
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `<h1>Hello World from Angular!</h1>`
})
export class AppComponent {
title = 'hello-world-app';
}
A simplified view of the key files and folders created by Angular CLI:
// Important parts of the generated Angular project
hello-world-app/
src/
app/
app.component.ts
app.component.html
app.module.ts
assets/
environments/
angular.json
package.json
After running ng serve and opening http://localhost:4200, you will first see the default Angular welcome page. Once you replace the template in app.component.ts with:
<h1>Hello World from Angular!</h1>
the browser will refresh (or you can reload manually), and you will see a clean heading:
AppComponent template.This confirms that your Angular setup is working and that you can now control what appears on the page through components.
ng serve -o to automatically open the app in your browser after starting the dev server.src/app/ organized by grouping related components and services into folders.app.component.html if you prefer separating HTML from TypeScript logic.todo-app or blog-app for real projects.my-first-app and run it locally.src/app/ folder and identify the role of app.module.ts.Welcome to my first Angular app..AppComponent and see how it affects where the component is rendered.