From 65da7e778d6cc49cdeba4d78169abfddd370a653 Mon Sep 17 00:00:00 2001 From: rupeshbangar Date: Tue, 10 Mar 2026 20:19:30 +0530 Subject: [PATCH] Building Components and Services --- Week-04/Day_01/README.md | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/Week-04/Day_01/README.md b/Week-04/Day_01/README.md index e69de29..b72009b 100644 --- a/Week-04/Day_01/README.md +++ b/Week-04/Day_01/README.md @@ -0,0 +1,59 @@ +# Angular Architecture: Components & Services + +### Overview +This project demonstrates the basic concepts of **Angular Components and Services**. +Angular applications are built using components that manage the user interface and services that handle business logic and data sharing. + +The goal of this task is to understand how components and services work together in an Angular application. + +--- + +## Angular Components + +A **Component** is the fundamental building block of an Angular application. +It controls a part of the user interface (UI) and defines how that UI behaves. + +Each component consists of: + +- **TypeScript Class** – Handles logic and data. +- **HTML Template** – Defines the structure of the UI. +- **CSS Styles** – Controls the appearance. + +### Advantages of Components +- Reusable UI elements +- Better code organization +- Easier debugging and maintenance +- Modular application structure + +--- + +## Angular Services + +A **Service** is used to share data, logic, or functionality across multiple components. + +Services help keep components simple by separating business logic from UI logic. + +Services are commonly used for: +- Fetching data from APIs +- Sharing data between components +- Implementing business logic +- Performing calculations + +--- + +## How Components and Services Work Together + +1. The **Component** handles user interaction. +2. The **Service** manages data and business logic. +3. Angular injects the service into the component using Dependency Injection. +4. The component displays the result in the UI. + +--- + +### Useful Commands Used Today +```bash +# Generate a new component +ng generate component components/task-list + +# Generate a new service +ng generate service services/task \ No newline at end of file