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

Angular Observable Operators

Learn how RxJS operators can transform, filter, inspect and control values flowing through an Observable stream.

What are Observable Operators?

Operators are functions that allow us to work with Observable streams without changing the original source directly.

Operators can transform values, filter unwanted values, perform side effects, limit emissions and combine different operations into a data-processing pipeline.

RxJS provides many operators that can be used with pipe().

Observable Operator Flow

Source Original Values
→
pipe() Operator Pipeline
→
Operator Transform / Filter
→
Subscriber Receives Result

Using pipe()

The pipe() method is used to connect one or more RxJS operators together.

The output of one operator becomes the input for the next operator in the pipeline.

Basic Syntax
const result$ = source$.pipe(
    operator1(),
    operator2()
);

Common RxJS Operators

M
map()

Transforms every emitted value into another value.

F
filter()

Allows only values that satisfy a condition.

T
tap()

Performs a side effect without changing the value.

K
take()

Takes a specified number of emitted values.

1. map() Operator

The map() operator transforms every value emitted by the source Observable.

It is useful when the application needs to convert the incoming data into another format.

Example
const numbers$ = of(10, 20, 30);

const doubled$ = numbers$.pipe(
    map(value => value * 2)
);

doubled$.subscribe({

    next: value => {

        console.log(value);

    }

});

Output

20

40

60

map() Transformation Flow

10 Original
→
map() value * 2
→
20 Transformed

2. filter() Operator

The filter() operator allows only those values that satisfy a specified condition.

Values that fail the condition are not emitted by the resulting Observable.

Example
const numbers$ = of(10, 15, 20, 25, 30);

const evenNumbers$ = numbers$.pipe(
    filter(value => value % 2 === 0)
);

evenNumbers$.subscribe({

    next: value => {

        console.log(value);

    }

});

Filtered Output

10

20

30

3. tap() Operator

The tap() operator is useful for performing side effects such as logging or debugging.

It does not transform the value being emitted.

Example
const courses$ = of(
    'Java',
    '.NET',
    'Python'
);

const result$ = courses$.pipe(

    tap(course => {

        console.log(
            'Received:',
            course
        );

    })

);

result$.subscribe({

    next: course => {

        console.log(
            'Display:',
            course
        );

    }

});

4. take() Operator

The take() operator allows only a specified number of values to pass through.

After the requested number of values is emitted, the resulting Observable completes.

Example
const numbers$ = of(
    1,
    2,
    3,
    4,
    5
);

const firstThree$ = numbers$.pipe(
    take(3)
);

firstThree$.subscribe({

    next: value => {

        console.log(value);

    }

});

Output

1

2

3

Using Multiple Operators

Multiple operators can be combined inside a single pipe().

This allows an Observable to pass through several processing steps before the subscriber receives the final values.

map() + filter()
const numbers$ = of(
    1,
    2,
    3,
    4,
    5
);

const result$ = numbers$.pipe(

    map(value => value * 10),

    filter(value => value >= 30)

);

result$.subscribe({

    next: value => {

        console.log(value);

    }

});

Processing Result

30

40

50

Operator Pipeline

1, 2, 3, 4, 5 Source
→
map() Multiply by 10
→
filter() Keep >= 30
→
30, 40, 50 Result

CIIT Training Institute Example

Suppose the CIIT Training Institute dashboard receives a list of course enquiry priorities.

We can use operators to transform the enquiry data and keep only the records needed by the dashboard.

Course Fees Example
const fees$ = of(
    15000,
    25000,
    35000,
    45000
);

const premiumCourses$ = fees$.pipe(

    filter(fee => fee >= 30000),

    map(fee => 'Course Fee: ₹' + fee)

);

premiumCourses$.subscribe({

    next: fee => {

        console.log(fee);

    }

});

CIIT Training Institute

Course Fee: ₹35000

Course Fee: ₹45000

Common Operators Overview

Operator Purpose Example
map() Transforms every value value * 2
filter() Filters values based on a condition value > 10
tap() Performs a side effect Logging
take() Takes a fixed number of values take(3)
pipe() Combines operators pipe(map(), filter())

Other Useful Operators

U
distinctUntilChanged()

Suppresses consecutive duplicate values.

S
skip()

Skips a specified number of initial emissions.

D
debounceTime()

Delays emissions until the source remains quiet for a period.

C
catchError()

Provides a way to handle errors in an Observable pipeline.

Operator Categories

T
Transformation

Changes emitted values, such as map().

F
Filtering

Controls which values continue through the stream.

C
Combination

Works with multiple Observable streams.

E
Error Handling

Handles failures in Observable processing.

Important Points

1. Operators Do Not Usually Modify the Source

Operators return another Observable representing the processed stream.

2. Use pipe()

Operators are commonly connected using the pipe() method.

3. Operators Can Be Chained

Multiple operators can be used in sequence to build a processing pipeline.

4. Choose Operators Based on the Requirement

Use transformation, filtering, timing, combination and error-handling operators according to the stream logic.

Operator Best Practices

  • Keep operator pipelines easy to read and understand.
  • Use map() when data needs transformation.
  • Use filter() when only matching values should continue.
  • Use tap() mainly for side effects such as logging or debugging.
  • Use suitable operators instead of manually handling every stream value.
  • Keep complex stream logic separated from presentation logic where practical.

Summary

RxJS operators allow Angular applications to transform, filter and control values flowing through Observable streams.

Operators are commonly combined using pipe().

Important operators include map(), filter(), tap() and take(). In the next topic, we will learn about Unsubscribe.