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 Project Structure

After creating an Angular application, Angular CLI generates a standard project structure containing source files, configuration files, dependencies and other resources.

What is Angular Project Structure?

Angular project structure defines how the files and folders of an Angular application are organized.

Understanding the project structure is important because different files have different responsibilities in an Angular application.

Example Project: CIITStudentApp

Angular Project Structure

CIITStudentApp
│
├── node_modules
│
├── public
│
├── src
│   ├── app
│   ├── assets
│   ├── index.html
│   ├── main.ts
│   └── styles.css
│
├── angular.json
├── package.json
├── package-lock.json
├── tsconfig.json
└── README.md

1. Project Root Folder

The project root folder is the main folder of the Angular application.

Project Folder
CIITStudentApp

All Angular source files, configuration files and installed dependencies are organized inside this project folder.

2. node_modules

The node_modules folder contains the packages and dependencies required by the Angular application.

Folder
node_modules/
Important

Developers normally do not modify files inside the node_modules folder manually.

3. public Folder

The public folder can contain static resources that need to be served as part of the application.

Folder
public/
    ├── images
    ├── icons
    └── other-static-files

4. src Folder

The src folder contains the main source code of the Angular application.

src
src/
├── app/
├── assets/
├── index.html
├── main.ts
└── styles.css
Remember: Most application development work is performed inside the src folder.

5. app Folder

The app folder contains the main Angular application code.

src/app
src/
└── app/
    ├── app.component.ts
    ├── app.component.html
    ├── app.component.css
    └── app.config.ts

Components, services, routing and other application-related code are commonly organized under this area.

6. Component Files

An Angular component contains the logic and user interface required for a particular part of the application.

TS
TypeScript

Contains component logic and data.

student.component.ts
HTML
HTML Template

Defines the component user interface.

student.component.html
CSS
Styles

Defines component styling.

student.component.css

7. assets Folder

The assets folder is used for application resources such as images, icons and other static files, depending on the project configuration.

Folder
src/assets/
├── images/
├── icons/
└── logos/

8. index.html

The index.html file is the main HTML document loaded by the browser.

index.html
<!doctype html>
<html lang="en">

<head>
    <title>CIIT Student App</title>
</head>

<body>
    <app-root></app-root>
</body>

</html>
Purpose

It provides the main HTML page in which the Angular application is loaded.

9. main.ts

The main.ts file acts as an entry point for starting the Angular application.

main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';

bootstrapApplication(AppComponent)
    .catch((err) => console.error(err));
In Simple Words

main.ts helps Angular bootstrap and start the application.

10. styles.css

The styles.css file contains global styles that can be applied across the Angular application.

styles.css
body {
    font-family: Arial, sans-serif;
    margin: 0;
}

h1 {
    color: #4c1d95;
}

11. angular.json

The angular.json file contains Angular CLI workspace and project configuration.

Build Application build configuration
Serve Development server configuration
Assets Static resource configuration
Styles Global style configuration

12. package.json

The package.json file contains information about the project, npm scripts and dependencies.

package.json
{
    "name": "ciit-student-app",
    "scripts": {
        "start": "ng serve"
    }
}

13. package-lock.json

The package-lock.json file records detailed information about the installed npm dependencies.

Purpose

It helps npm maintain consistent dependency versions during installation.

14. tsconfig.json

Angular applications use TypeScript. The tsconfig.json file contains TypeScript compiler configuration.

Configuration File
tsconfig.json

15. README.md

The README.md file is used to provide documentation and information about the project.

Important Files and Folders

File / Folder Purpose
node_modules Contains installed npm dependencies.
public Contains public static resources.
src Contains Angular source code.
src/app Contains application-related Angular code.
index.html Main HTML document.
main.ts Application bootstrap entry point.
angular.json Angular CLI configuration.
package.json Project dependencies and npm scripts.
package-lock.json Records dependency installation details.
tsconfig.json TypeScript configuration.
README.md Project documentation.

Angular Project Structure Flow

1

Project Root

CIITStudentApp

→
2

src

Application source code

→
3

app

Components and application logic

→
4

Browser

Angular Application

Common Mistakes

1. Editing node_modules manually

Avoid manually changing files inside the node_modules folder.

2. Working from the wrong folder

Make sure you are inside the Angular project folder before running Angular CLI commands.

3. Confusing project root and src

The project root contains configuration files, while src mainly contains application source code.

Summary

An Angular application contains different folders and configuration files, each having a specific purpose.

The most important development area is src, which contains the Angular application source code.

Important files such as main.ts, angular.json, package.json and tsconfig.json help configure and run the Angular application.