Master Angular From Scratch

Learn Angular with clear, interactive, and structured lessons for beginners and developers.

ANGULAR COURSE SYLLABUS
1. Angular Introduction
Angular Introduction Angular History Angular Fundamentals Angular Architecture Component-Based Angular
2. Angular Setup
Angular Setup Introduction Installing Node.js Installing Angular CLI Creating an Angular Application Angular Project Structure
3. Components
Components Overview Component Anatomy Creating Components Component Selector Component Template Component Styles Component Metadata Standalone Components Parent and Child Components Reusable Components
4. Templates
Templates Introduction Template Syntax Template Expressions Template Statements Template Reference Variables ng-template ng-container ngTemplateOutlet Built-in Control Flow
5. Data Binding
Data Binding Introduction Interpolation Binding Property Binding Event Binding Two-Way Data Binding Class & Style Binding
6. Directives
Directives Introduction Attribute Directives Structural Directives Custom Directives
7. Pipes
Pipes Introduction Built-in Pipes Parameterized Pipes Chaining Pipes Custom Pipes
8. Event Handling
Event Handling Introduction DOM Events Event Binding Syntax Event Object Passing Data to Event Handlers
9. Input & Output
Component Communication @Input @Output EventEmitter
10. Lifecycle Hooks
Lifecycle Hooks Introduction ngOnInit ngOnChanges ngAfterViewInit ngOnDestroy
11. Services
Services Introduction Creating Angular Services Using Services in Components Sharing Data Through Services Service Scope
12. Dependency Injection
Dependency Injection Introduction Injecting Dependencies InjectionToken Provider Configuration
13. Routing
Routing Introduction Route Configuration RouterLink & Navigation Route Parameters Child Routes Route Guards
14. Forms
Angular Forms Introduction Template-Driven Forms Reactive Forms Form Validation Form Submission & Error Handling
15. HttpClient
HttpClient Introduction Configuring HttpClient GET Request POST, PUT & DELETE Requests Headers & Parameters HTTP Error Handling
16. Observables
Observables Introduction Creating & Subscribing to Observables Observable Data Streams Observable Operators Subscription Management
17. RxJS
RxJS Introduction RxJS Operators Transformation & Filtering Combining Observables Higher-Order Mapping Subjects
18. API Integration
API Integration Introduction Connecting Angular with REST API Consuming API Data CRUD API Integration API Response & Error Handling

Installing Angular CLI

Angular CLI is a command-line tool used to create, develop, test, build and manage Angular applications.

What is Angular CLI?

Angular CLI stands for Angular Command Line Interface. It provides a set of commands that help developers create and manage Angular applications from the terminal.

Instead of manually creating every Angular file and folder, Angular CLI can automatically generate the required project structure and development files.

In Simple Words

Angular CLI is a development tool that makes it easier to create, run, generate and build Angular applications.

Why Do We Need Angular CLI?

1

Create

Create new Angular applications quickly.

2

Generate

Generate components, services and other files.

3

Develop

Run Angular applications using the development server.

4

Build

Build Angular applications for deployment.

Prerequisite

Before installing Angular CLI, make sure that Node.js and npm are installed on your system.

✓

Node.js

Required runtime environment.

+
✓

npm

Required package manager.

→
✓

Angular CLI

Angular development tool.

Step 1: Check Node.js

Open Command Prompt or Terminal and check whether Node.js is installed.

Terminal
node --version
Expected Output

The terminal displays the installed Node.js version.

v[installed-version]

Step 2: Check npm

npm is normally installed together with Node.js. Verify the npm installation using the following command.

Terminal
npm --version
Expected Output

The terminal displays the installed npm version.

[installed-npm-version]

Step 3: Install Angular CLI

Now install Angular CLI globally using npm. Open Command Prompt or Terminal and execute:

Terminal
npm install -g @angular/cli

What does this command mean?

npm is the package manager, install installs a package, -g installs it globally, and @angular/cli is the Angular CLI package.

A global installation allows the Angular CLI command to be used from different project folders.

Angular CLI Installation Flow

Terminal Developer enters command
↓
npm Downloads Angular CLI
↓
Angular CLI Installed globally
↓
ng Command Ready for Angular development

Step 4: Verify Angular CLI Installation

After Angular CLI installation is completed, verify the installation using the following command:

Terminal
ng version
Expected Output

Angular CLI displays information about the installed Angular CLI version, Node.js version and related packages.

Angular CLI: [version]
Node: [version]
Package Manager: npm [version]

What is the ng Command?

After installing Angular CLI, the ng command becomes available in the terminal.

The ng command is used for different Angular development operations such as creating applications, generating components, running the development server and building applications.

Terminal
ng
Expected Result

Angular CLI displays the available Angular commands and options.

Important Angular CLI Commands

Command Purpose
ng version Display Angular CLI version information
ng new ProjectName Create a new Angular application
ng serve Start the Angular development server
ng generate component name Generate a new Angular component
ng generate service name Generate an Angular service
ng build Build the Angular application

Example: Generate a Student Component

Suppose we want to create a component for displaying student information.

Terminal
ng generate component student

Angular CLI generates the required component files automatically.

📄 student.component.ts
📄 student.component.html
📄 student.component.css
📄 student.component.spec.ts

Common Installation Issues

'ng' is not recognized

If the terminal does not recognize the ng command, close the terminal and open it again.

Installation Permission Issue

If npm shows a permission-related error, open the terminal with appropriate permissions and try the installation again.

Check Node.js and npm

Make sure Node.js and npm are installed correctly before installing Angular CLI.

Summary

Angular CLI is a command-line tool used to create, generate, develop and build Angular applications.

The Angular CLI can be installed globally using npm install -g @angular/cli.

After installation, use ng version to verify the Angular CLI installation.

In the next topic, we will learn how to Create an Angular Application.