Activity 23: Angular Services

froilanfroilan
38 min read

What is Angular Services?:

You might need to use features from other classes when developing a smaller component of your system, such as a module or class. For example, in order to conduct backend calls, you could want an HTTP service. A design pattern and mechanism for producing and distributing certain application components to other application components that need them is called dependency injection, or DI. You can utilize this design pattern, which Angular supports, to improve the flexibility and modularity of your apps.

Dependencies in Angular are usually services, although they can also be values, like functions or strings. When necessary, an injector for an application—which is automatically generated during bootstrap—instantiates dependencies by utilizing a defined service or value provider.


  1. Student List Service:

     // Updated student-list.component.ts:
     import { NgForOf } from '@angular/common';
     import { Component } from '@angular/core';
     import { FormsModule } from '@angular/forms';
     import { StudentListService } from '@app/services/student-list/student-list.service';
     import StudentList from '@app/interface/student-list';
    
     @Component({
         selector: 'app-student-list',
         standalone: true,
         imports: [NgForOf, FormsModule],
         templateUrl: './student-list.component.html',
     })
     export class StudentListComponent {
         constructor(private studentListService: StudentListService) {
             this.students = this.studentListService.getStudents();
         }
         students: StudentList[] = [];
         id: string = '';
         name: string = '';
         grade: string = '';
         age: number = 0;
    
         addStudent(): void {
             this.studentListService.addStudent(
                 this.id,
                 this.name,
                 this.grade,
                 this.age,
             );
             this.age = 0;
             this.grade = '';
             this.id = '';
             this.name = '';
         }
     }
    
     // student-list.service.ts:
     import { Injectable } from '@angular/core';
     import StudentList from '@app/interface/student-list';
    
     @Injectable({
         providedIn: 'root',
     })
     export class StudentListService {
         students: StudentList[] = [];
    
         constructor() {}
    
         addStudent(id: string, name: string, grade: string, age: number): void {
             this.students.push({
                 id: id,
                 name: name,
                 grade: grade,
                 age: age,
             });
         }
    
         getStudents(): StudentList[] {
             return this.students;
         }
     }
    

  2. Employee List:

     // employee-list.component.ts:
     import { Component } from '@angular/core';
     import { NgForOf } from '@angular/common';
     import { FormsModule } from '@angular/forms';
     import { EmployeeList } from '@app/interface/employee-list';
     import { EmployeeListService } from '@app/services/employee-list/employee-list.service';
    
     @Component({
         selector: 'app-employee-list',
         standalone: true,
         imports: [NgForOf, FormsModule],
         templateUrl: './employee-list.component.html',
         styles: ``,
     })
     export class EmployeeListComponent {
         employees = [] as EmployeeList[];
         constructor(private employeeListService: EmployeeListService) {
             this.employees = this.employeeListService.getEmployees();
         }
    
         id: string = '';
         name: string = '';
         position: string = '';
         age: number = 0;
    
         addEmployee(): void {
             this.employeeListService.addEmployee(
                 this.id,
                 this.name,
                 this.position,
                 this.age,
             );
    
             this.age = 0;
             this.position = '';
             this.id = '';
             this.name = '';
         }
     }
     // employee-list.service.ts:
     import { Injectable } from '@angular/core';
     import { EmployeeList } from '@app/interface/employee-list';
    
     @Injectable({
         providedIn: 'root',
     })
     export class EmployeeListService {
         private employees: EmployeeList[] = [];
    
         constructor() {}
    
         addEmployee(id: string, name: string, position: string, age: number): void {
             this.employees.push({
                 id: id,
                 name: name,
                 position: position,
                 age: age,
             });
         }
    
         getEmployees(): EmployeeList[] {
             return this.employees;
         }
     }
    

  3. Fruit List:

     // fruit-list.component.ts:
     import { Component } from '@angular/core';
     import FruitList from '@app/interface/fruit-list';
     import { FormsModule } from '@angular/forms';
     import { NgForOf } from '@angular/common';
     import { FruitListService } from '@app/services/fruit-list/fruit-list.service';
    
     @Component({
         selector: 'app-fruit-list',
         standalone: true,
         imports: [FormsModule, NgForOf],
         templateUrl: './fruit-list.component.html',
         styles: ``,
     })
     export class FruitListComponent {
         fruits = [] as FruitList[];
         constructor(private fruitService: FruitListService) {
             this.fruits = this.fruitService.getFruits();
         }
    
         id: string = '';
         name: string = '';
         quantity: number = 0;
         price: number = 0;
    
         addFruit(): void {
             this.fruitService.addFruit(
                 this.id,
                 this.name,
                 this.price,
                 this.quantity,
             );
    
             this.id = '';
             this.name = '';
             this.quantity = 0;
             this.price = 0;
         }
     }
     // fruit-list.service.ts:
     import { Injectable } from '@angular/core';
     import FruitList from '@app/interface/fruit-list';
    
     @Injectable({
         providedIn: 'root',
     })
     export class FruitListService {
         private fruits: FruitList[] = [];
    
         constructor() {}
    
         addFruit(id: string, name: string, price: number, quantity: number): void {
             this.fruits.push({
                 id: id,
                 name: name,
                 price: price,
                 quantity: quantity,
             });
         }
    
         getFruits(): FruitList[] {
             return this.fruits;
         }
     }
    

  4. Course List:

     // course-list.component.ts
     import { Component } from '@angular/core';
     import { NgForOf } from '@angular/common';
     import { FormsModule } from '@angular/forms';
     import { CourseList } from '@app/interface/course-list';
     import { CourseListService } from '@app/services/course-list/course-list.service';
    
     @Component({
         selector: 'app-course-list',
         standalone: true,
         imports: [NgForOf, FormsModule],
         templateUrl: './course-list.component.html',
         styles: ``,
     })
     export class CourseListComponent {
         courses = [] as CourseList[];
         constructor(private courseListService: CourseListService) {
             this.courses = this.courseListService.getCourses();
         }
    
         id: string = '';
         name: string = '';
         teacher: string = '';
         credit: number = 0;
    
         addCourse(): void {
             this.courseListService.addCourse(
                 this.id,
                 this.name,
                 this.teacher,
                 this.credit,
             );
    
             this.id = '';
             this.name = '';
             this.teacher = '';
             this.credit = 0;
         }
     }
     // course-list.service.ts:
     import { Injectable } from '@angular/core';
     import { CourseList } from '@app/interface/course-list';
    
     @Injectable({
         providedIn: 'root',
     })
     export class CourseListService {
         private courses: CourseList[] = [];
    
         constructor() {}
    
         addCourse(id: string, name: string, teacher: string, credit: number): void {
             this.courses.push({
                 id: id,
                 name: name,
                 teacher: teacher,
                 credit: credit,
             });
         }
    
         getCourses(): CourseList[] {
             return this.courses;
         }
     }
    

  5. Book List:

     // book-list.component.ts
     import { Component } from '@angular/core';
     import BookList from '@app/interface/book-list';
     import { FormsModule } from '@angular/forms';
     import { NgForOf } from '@angular/common';
     import { BookListService } from '@app/services/book-list/book-list.service';
    
     @Component({
         selector: 'app-book-list',
         standalone: true,
         imports: [FormsModule, NgForOf],
         templateUrl: './book-list.component.html',
         styles: ``,
     })
     export class BookListComponent {
         books = [] as BookList[];
         constructor(private bookService: BookListService) {
             this.books = this.bookService.getBooks();
         }
    
         id: string = '';
         name: string = '';
         isbn: string = '';
    
         addBook(): void {
             this.bookService.addBook(this.id, this.name, this.isbn);
             this.id = '';
             this.name = '';
             this.isbn = '';
         }
     }
     // book-list.service.ts:
     import { Injectable } from '@angular/core';
     import BookList from '@app/interface/book-list';
    
     @Injectable({
         providedIn: 'root',
     })
     export class BookListService {
         private books: BookList[] = [];
    
         constructor() {}
    
         addBook(id: string, name: string, isbn: string): void {
             this.books.push({
                 id: id,
                 name: name,
                 isbn: isbn,
             });
         }
    
         getBooks(): BookList[] {
             return this.books;
         }
     }
    

  6. City List:

     // city-list.component.ts:
     import { Component } from '@angular/core';
     import { NgForOf } from '@angular/common';
     import { FormsModule } from '@angular/forms';
     import CityList from '@app/interface/city-list';
     import { CityListService } from '@app/services/city-list/city-list.service';
    
     @Component({
         selector: 'app-city-list',
         standalone: true,
         imports: [NgForOf, FormsModule],
         templateUrl: './city-list.component.html',
         styles: ``,
     })
     export class CityListComponent {
         cities = [] as CityList[];
         constructor(private cityService: CityListService) {
             this.cities = this.cityService.getCities();
         }
    
         id: string = '';
         name: string = '';
         country: string = '';
         population: number = 0;
    
         addCity(): void {
             this.cityService.addCity(
                 this.id,
                 this.name,
                 this.country,
                 Number(this.population),
             );
    
             this.id = '';
             this.name = '';
             this.country = '';
             this.population = 0;
         }
     }
     // city-list.service.ts:
     import { Injectable } from '@angular/core';
     import CityList from '@app/interface/city-list';
    
     @Injectable({
         providedIn: 'root',
     })
     export class CityListService {
         private cities: CityList[] = [];
    
         constructor() {}
    
         addCity(
             id: string,
             name: string,
             country: string,
             population: number,
         ): void {
             this.cities.push({
                 id: id,
                 name: name,
                 country: country,
                 population: population,
             });
         }
    
         getCities(): CityList[] {
             return this.cities;
         }
     }
    

  7. Movie List:

     // movie-list.component.ts
     import { Component } from '@angular/core';
     import { NgForOf } from '@angular/common';
     import { FormsModule } from '@angular/forms';
     import MovieList from '@app/interface/movie-list';
     import { MovieListService } from '@app/services/movie-list/movie-list.service';
    
     @Component({
         selector: 'app-movie-list',
         standalone: true,
         imports: [NgForOf, FormsModule],
         templateUrl: './movie-list.component.html',
         styles: ``,
     })
     export class MovieListComponent {
         movies = [] as MovieList[];
         constructor(private movieService: MovieListService) {
             this.movies = this.movieService.getMovies();
         }
    
         id: string = '';
         name: string = '';
         director: string = '';
         year: number = 0;
         rating: number = 0;
    
         addMovie(): void {
             this.movieService.addMovie(
                 this.id,
                 this.name,
                 this.director,
                 this.year,
                 this.rating,
             );
    
             this.id = '';
             this.name = '';
             this.director = '';
             this.year = 0;
             this.rating = 0;
         }
     }
     // movie-list.service.ts
     import { Injectable } from '@angular/core';
     import MovieList from '@app/interface/movie-list';
    
     @Injectable({
         providedIn: 'root',
     })
     export class MovieListService {
         private movies: MovieList[] = [];
    
         constructor() {}
    
         addMovie(
             id: string,
             name: string,
             director: string,
             year: number,
             rating: number,
         ): void {
             this.movies.push({
                 id: id,
                 name: name,
                 director: director,
                 year: year,
                 rating: rating,
             });
         }
    
         getMovies(): MovieList[] {
             return this.movies;
         }
     }
    

  8. Car Model List:

     // card-mode-list.component.ts
     import { Component } from '@angular/core';
     import { NgForOf } from '@angular/common';
     import { FormsModule } from '@angular/forms';
     import CarModel from '@app/interface/car-model';
     import { CarModelListService } from '@app/services/car-model-list/car-model-list.service';
    
     @Component({
         selector: 'app-card-model-list',
         standalone: true,
         imports: [NgForOf, FormsModule],
         templateUrl: './car-model-list.component.html',
         styles: ``,
     })
     export class CarModelListComponent {
         carModels = [] as CarModel[];
         constructor(private carModelService: CarModelListService) {
             this.carModels = this.carModelService.getCarModels();
         }
         id: number = 0;
         name: string = '';
         year: number = 0;
         make: string = '';
         model: string = '';
         price: number = 0;
    
         addCarModel(): void {
             this.carModelService.addCarModel(
                 this.id,
                 this.name,
                 this.year,
                 this.make,
                 this.model,
                 this.price,
             );
    
             this.id = 0;
             this.name = '';
             this.year = 0;
             this.make = '';
             this.model = '';
             this.price = 0;
         }
     }
     // car-model-list.service.ts:
     import { Injectable } from '@angular/core';
     import CarModel from '@app/interface/car-model';
    
     @Injectable({
         providedIn: 'root',
     })
     export class CarModelListService {
         private carModels: CarModel[] = [];
    
         constructor() {}
    
         addCarModel(
             id: number,
             name: string,
             year: number,
             make: string,
             model: string,
             price: number,
         ): void {
             this.carModels.push({
                 id: id,
                 name: name,
                 year: year,
                 make: make,
                 model: model,
                 price: price,
             });
         }
    
         getCarModels(): CarModel[] {
             return this.carModels;
         }
     }
    

  9. Product List:

     // product-list.component.ts
     import { Component } from '@angular/core';
     import Product from '@app/interface/product-list';
     import { NgForOf } from '@angular/common';
     import { FormsModule } from '@angular/forms';
     import { ProductListService } from '@app/services/product-list/product-list.service';
    
     @Component({
         selector: 'app-product-list',
         standalone: true,
         imports: [NgForOf, FormsModule],
         templateUrl: './product-list.component.html',
         styles: ``,
     })
     export class ProductListComponent {
         products = [] as Product[];
         constructor(private productService: ProductListService) {
             this.products = this.productService.getProducts();
         }
         id: number = 0;
         name: string = '';
         price: number = 0;
    
         addProduct(): void {
             this.productService.addProduct(Number(this.id), this.name, this.price);
             this.id = 0;
             this.name = '';
             this.price = 0;
         }
     }
     // product-list.service.ts:
     import { Injectable } from '@angular/core';
     import Product from '@app/interface/product-list';
    
     @Injectable({
         providedIn: 'root',
     })
     export class ProductListService {
         private products: Product[] = [];
    
         constructor() {}
    
         addProduct(id: number, name: string, price: number): void {
             this.products.push({
                 id: id,
                 name: name,
                 price: price,
             });
         }
    
         getProducts(): Product[] {
             return this.products;
         }
     }
    

  10. Subject List:

    // subject-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import Subject from '@app/interface/subject-list';
    import { SubjectListService } from '@app/services/subject-list/subject-list.service';
    
    @Component({
        selector: 'app-subject-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './subject-list.component.html',
        styles: ``,
    })
    export class SubjectListComponent {
        subjects = [] as Subject[];
    
        constructor(private subjectListService: SubjectListService) {
            this.subjects = this.subjectListService.getSubjects();
        }
    
        id: number = 0;
        name: string = '';
        teacher: string = '';
    
        addSubject(): void {
            this.subjectListService.addSubject(this.id, this.name, this.teacher);
            this.id = 0;
            this.name = '';
            this.teacher = '';
        }
    }
    // subject-list.service.ts
    import { Injectable } from '@angular/core';
    import SubjectList from '@app/interface/subject-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class SubjectListService {
        private subjects: SubjectList[] = [];
    
        constructor() {}
    
        addSubject(id: number, name: string, teacher: string): void {
            this.subjects.push({
                id: id,
                name: name,
                teacher: teacher,
            });
        }
    
        getSubjects(): SubjectList[] {
            return this.subjects;
        }
    }
    

  11. Country List:

    // country-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import Country from '@app/interface/country-list';
    import { CountryListService } from '@app/services/country-list/country-list.service';
    
    @Component({
        selector: 'app-country-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './country-list.component.html',
        styles: ``,
    })
    export class CountryListComponent {
        countries = [] as Country[];
        constructor(private countryListService: CountryListService) {
            this.countries = this.countryListService.getCountries();
        }
    
        id: number = 0;
        name: string = '';
        capital: string = '';
        population: number = 0;
    
        addCountry(): void {
            this.countryListService.addCountry(
                this.id,
                this.name,
                this.capital,
                this.population,
            );
    
            this.id = 0;
            this.name = '';
            this.capital = '';
            this.population = 0;
        }
    }
    // country-list.service.ts
    import { Injectable } from '@angular/core';
    import Country from '@app/interface/country-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class CountryListService {
        private countries: Country[] = [];
    
        constructor() {}
    
        addCountry(
            id: number,
            name: string,
            capital: string,
            population: number,
        ): void {
            this.countries.push({
                id: id,
                name: name,
                capital: capital,
                population: population,
            });
        }
    
        getCountries(): Country[] {
            return this.countries;
        }
    }
    

  12. Sports List:

    // sports-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import Sports from '@app/interface/sports-list';
    import { SportsListService } from '@app/services/sports-list/sports-list.service';
    
    @Component({
        selector: 'app-sports-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './sports-list.component.html',
        styles: ``,
    })
    export class SportsListComponent {
        sports = [] as Sports[];
        constructor(private sportsService: SportsListService) {
            this.sports = this.sportsService.getSports();
        }
        id: number = 0;
        name: string = '';
        team: string = '';
    
        addSport(): void {
            this.sportsService.addSport(this.id, this.name, this.team);
    
            this.id = 0;
            this.name = '';
            this.team = '';
        }
    }
    // sports-list.service.ts
    import { Injectable } from '@angular/core';
    import Sports from '@app/interface/sports-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class SportsListService {
        private sports: Sports[] = [];
    
        constructor() {}
    
        addSport(id: number, name: string, team: string): void {
            this.sports.push({
                id: id,
                name: name,
                team: team,
            });
        }
    
        getSports(): Sports[] {
            return this.sports;
        }
    }
    

  13. Vegetable List:

    // vegetables-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import Vegetables from '@app/interface/vegetables-list';
    import { VegetableListService } from '@app/services/vegetable-list/vegetable-list.service';
    
    @Component({
        selector: 'app-vegetables-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './vegetables-list.component.html',
        styles: ``,
    })
    export class VegetablesListComponent {
        vegetables = [] as Vegetables[];
        constructor(private vegetableListService: VegetableListService) {
            this.vegetables = this.vegetableListService.getVegetables();
        }
    
        id: number = 0;
        name: string = '';
        price: number = 0;
    
        addVegetable(): void {
            this.vegetableListService.addVegetable(this.id, this.name, this.price);
    
            this.id = 0;
            this.name = '';
            this.price = 0;
        }
    }
    // vegetable-list.service.ts
    import { Injectable } from '@angular/core';
    import Vegetables from '@app/interface/vegetables-list';
    @Injectable({
        providedIn: 'root',
    })
    export class VegetableListService {
        private vegetables: Vegetables[] = [];
    
        constructor() {}
    
        addVegetable(id: number, name: string, price: number): void {
            this.vegetables.push({
                id: id,
                name: name,
                price: price,
            });
        }
    
        getVegetables(): Vegetables[] {
            return this.vegetables;
        }
    }
    

  14. Animals List:

    // animals-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import Animals from '@app/interface/animals-list';
    import { AnimalListService } from '@app/services/animal-list/animal-list.service';
    
    @Component({
        selector: 'app-animals-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './animals-list.component.html',
        styles: ``,
    })
    export class AnimalsListComponent {
        animals = [] as Animals[];
        constructor(private animalService: AnimalListService) {
            this.animals = this.animalService.getAnimals();
        }
    
        id: number = 0;
        name: string = '';
        origin: string = '';
    
        addAnimal(): void {
            this.animalService.addAnimal(this.id, this.name, this.origin);
            this.id = 0;
            this.name = '';
            this.origin = '';
        }
    }
    // animal-list.service.ts
    import { Injectable } from '@angular/core';
    import Animals from '@app/interface/animals-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class AnimalListService {
        private animals: Animals[] = [];
    
        constructor() {}
    
        addAnimal(id: number, name: string, origin: string): void {
            this.animals.push({
                id: id,
                name: name,
                origin: origin,
            });
        }
    
        getAnimals(): Animals[] {
            return this.animals;
        }
    }
    

  15. Tool List:

    // tool-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import Tool from '@app/interface/tool-list';
    import { ToolListService } from '@app/services/tool-list/tool-list.service';
    
    @Component({
        selector: 'app-tool-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './tool-list.component.html',
        styles: ``,
    })
    export class ToolListComponent {
        tools = [] as Tool[];
        constructor(private toolService: ToolListService) {
            this.tools = this.toolService.getTools();
        }
    
        id: number = 0;
        name: string = '';
        description: string = '';
        price: number = 0;
        quantity: number = 0;
    
        addTool(): void {
            this.toolService.addTool(
                this.id,
                this.name,
                this.description,
                this.price,
                this.quantity,
            );
    
            this.id = 0;
            this.name = '';
            this.description = '';
            this.price = 0;
            this.quantity = 0;
        }
    }
    // tool-list.service.ts
    import { Injectable } from '@angular/core';
    import ToolList from '@app/interface/tool-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class ToolListService {
        private tools: ToolList[] = [];
    
        constructor() {}
    
        addTool(
            id: number,
            name: string,
            description: string,
            price: number,
            quantity: number,
        ): void {
            this.tools.push({
                id: id,
                name: name,
                description: description,
                price: price,
                quantity: quantity,
            });
        }
    
        getTools(): ToolList[] {
            return this.tools;
        }
    }
    

  16. Language List:

    // language-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import Language from '@app/interface/language-list';
    import { LanguageListService } from '@app/services/language-list/language-list.service';
    
    @Component({
        selector: 'app-language-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './language-list.component.html',
        styles: ``,
    })
    export class LanguageListComponent {
        languages = [] as Language[];
        constructor(private languageService: LanguageListService) {
            this.languages = this.languageService.getLanguages();
        }
    
        id: number = 0;
        name: string = '';
        description: string = '';
        origin: string = '';
    
        addLanguage(): void {
            this.languageService.addLanguage(
                this.id,
                this.name,
                this.description,
                this.origin,
            );
    
            this.id = 0;
            this.name = '';
            this.description = '';
            this.origin = '';
        }
    }
    // language-list.service.ts
    import { Injectable } from '@angular/core';
    import LanguageList from '@app/interface/language-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class LanguageListService {
        private languages: LanguageList[] = [];
    
        constructor() {}
    
        addLanguage(
            id: number,
            name: string,
            description: string,
            origin: string,
        ): void {
            this.languages.push({
                id: id,
                name: name,
                description: description,
                origin: origin,
            });
        }
    
        getLanguages(): LanguageList[] {
            return this.languages;
        }
    }
    

  17. Game List:

    // game-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import GameList from '@app/interface/game-list';
    import { GameListService } from '@app/services/game-list/game-list.service';
    
    @Component({
        selector: 'app-game-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './game-list.component.html',
        styles: ``,
    })
    export class GameListComponent {
        games = [] as GameList[];
        constructor(private gameService: GameListService) {
            this.games = this.gameService.getGames();
        }
    
        id: number = 0;
        name: string = '';
        description: string = '';
        platform: string = '';
    
        addGame(): void {
            this.gameService.addGame(
                this.id,
                this.name,
                this.description,
                this.platform,
            );
    
            this.id = 0;
            this.name = '';
            this.description = '';
            this.platform = '';
        }
    }
    // game-list.service.ts
    import { Injectable } from '@angular/core';
    import GameList from '@app/interface/game-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class GameListService {
        private games: GameList[] = [];
    
        constructor() {}
    
        addGame(
            id: number,
            name: string,
            description: string,
            platform: string,
        ): void {
            this.games.push({
                id: id,
                name: name,
                description: description,
                platform: platform,
            });
        }
    
        getGames(): GameList[] {
            return this.games;
        }
    }
    

  18. Software List:

    // software-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import SoftwareList from '@app/interface/software-list';
    import { SoftwareListService } from '@app/services/software-list/software-list.service';
    
    @Component({
        selector: 'app-software-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './software-list.component.html',
        styles: ``,
    })
    export class SoftwareListComponent {
        softwareList = [] as SoftwareList[];
        constructor(private softwareListService: SoftwareListService) {
            this.softwareList = this.softwareListService.getSoftware();
        }
        id: number = 0;
        name: string = '';
        description: string = '';
        platform: string = '';
    
        addSoftware(): void {
            this.softwareListService.addSoftware(
                this.id,
                this.name,
                this.description,
                this.platform,
            );
    
            this.id = 0;
            this.name = '';
            this.description = '';
            this.platform = '';
        }
    }
    // software-list.service.ts
    import { Injectable } from '@angular/core';
    import SoftwareList from '@app/interface/software-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class SoftwareListService {
        private software: SoftwareList[] = [];
    
        constructor() {}
    
        addSoftware(
            id: number,
            name: string,
            description: string,
            platform: string,
        ): void {
            this.software.push({
                id: id,
                name: name,
                description: description,
                platform: platform,
            });
        }
    
        getSoftware(): SoftwareList[] {
            return this.software;
        }
    }
    

  19. Phone Contact List:

    // phone-contact-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import PhoneContactList from '@app/interface/phone-contact-list';
    import { PhoneContactListService } from '@app/services/phone-contact-list/phone-contact-list.service';
    
    @Component({
        selector: 'app-phone-contact-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './phone-contact-list.component.html',
        styles: ``,
    })
    export class PhoneContactListComponent {
        phoneContactList = [] as PhoneContactList[];
        constructor(private phoneContactListService: PhoneContactListService) {
            this.phoneContactList = this.phoneContactListService.getPhoneContacts();
        }
        id: number = 0;
        name: string = '';
        email: string = '';
        phone: string = '';
    
        addPhoneContact(): void {
            this.phoneContactListService.addPhoneContact(
                this.id,
                this.name,
                this.email,
                this.phone,
            );
    
            this.id = 0;
            this.name = '';
            this.email = '';
            this.phone = '';
        }
    }
    // phone-contact-list.service.ts
    import { Injectable } from '@angular/core';
    import PhoneContactList from '@app/interface/phone-contact-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class PhoneContactListService {
        private phoneContacts: PhoneContactList[] = [];
    
        constructor() {}
    
        addPhoneContact(
            id: number,
            name: string,
            email: string,
            phone: string,
        ): void {
            this.phoneContacts.push({
                id: id,
                name: name,
                email: email,
                phone: phone,
            });
        }
    
        getPhoneContacts(): PhoneContactList[] {
            return this.phoneContacts;
        }
    }
    

  20. Music Play List:

    // music-play-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import MusicPlayList from '@app/interface/music-play-list';
    import { MusicPlayListService } from '@app/services/music-play-list/music-play-list.service';
    
    @Component({
        selector: 'app-music-play-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './music-play-list.component.html',
        styles: ``,
    })
    export class MusicPlayListComponent {
        musicPlayList = [] as MusicPlayList[];
        constructor(private musicPlayListService: MusicPlayListService) {
            this.musicPlayList = this.musicPlayListService.getMusicPlayList();
        }
        id: number = 0;
        name: string = '';
        artist: string = '';
        album: string = '';
        duration: number = 0;
        genre: string = '';
        year: number = 0;
    
        addMusicPlayList(): void {
            this.musicPlayListService.addMusicPlayList(
                this.id,
                this.name,
                this.artist,
                this.album,
                this.duration,
                this.genre,
                this.year,
            );
    
            this.id = 0;
            this.name = '';
            this.artist = '';
            this.album = '';
            this.duration = 0;
            this.genre = '';
            this.year = 0;
        }
    }
    // music-play-list.service.ts
    import { Injectable } from '@angular/core';
    import MusicPlayList from '@app/interface/music-play-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class MusicPlayListService {
        private musicPlayList: MusicPlayList[] = [];
    
        constructor() {}
    
        addMusicPlayList(
            id: number,
            name: string,
            artist: string,
            album: string,
            duration: number,
            genre: string,
            year: number,
        ): void {
            this.musicPlayList.push({
                id: id,
                name: name,
                artist: artist,
                album: album,
                duration: duration,
                genre: genre,
                year: year,
            });
        }
    
        getMusicPlayList(): MusicPlayList[] {
            return this.musicPlayList;
        }
    }
    

  21. Food Menu List:

    // food-menu-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import FoodMenuList from '@app/interface/food-menu-list';
    import { FoodMenuListService } from '@app/services/food-menu-list/food-menu-list.service';
    
    @Component({
        selector: 'app-food-menu-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './food-menu-list.component.html',
        styles: ``,
    })
    export class FoodMenuListComponent {
        foodMenuList = [] as FoodMenuList[];
        constructor(private foodMenuService: FoodMenuListService) {
            this.foodMenuList = this.foodMenuService.getFoodMenus();
        }
    
        id: number = 0;
        name: string = '';
        price: number = 0;
        description: string = '';
        rating: number = 0;
    
        addFoodMenu() {
            this.foodMenuService.addFoodMenu(
                this.id,
                this.name,
                this.price,
                this.description,
                this.rating,
            );
            this.id = 0;
            this.name = '';
            this.price = 0;
            this.description = '';
            this.rating = 0;
        }
    }
    // food-menu-list.service.ts
    import { Injectable } from '@angular/core';
    import FoodMenuList from '@app/interface/food-menu-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class FoodMenuListService {
        private foodMenus: FoodMenuList[] = [];
    
        constructor() {}
    
        addFoodMenu(
            id: number,
            name: string,
            price: number,
            description: string,
            rating: number,
        ): void {
            this.foodMenus.push({
                id: id,
                name: name,
                price: price,
                description: description,
                rating: rating,
            });
        }
    
        getFoodMenus(): FoodMenuList[] {
            return this.foodMenus;
        }
    }
    

  22. Grocery List:

    // grocery-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import GroceryList from '@app/interface/grocery-list';
    import { GroceryListService } from '@app/services/grocery-list/grocery-list.service';
    
    @Component({
        selector: 'app-grocery-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './grocery-list.component.html',
        styles: ``,
    })
    export class GroceryListComponent {
        groceryList = [] as GroceryList[];
        constructor(private groceryService: GroceryListService) {
            this.groceryList = this.groceryService.getGroceries();
        }
    
        id: number = 0;
        name: string = '';
        price: number = 0;
        description: string = '';
    
        addGrocery() {
            this.groceryService.addGrocery(
                this.id,
                this.name,
                this.price,
                this.description,
            );
            this.id = 0;
            this.name = '';
            this.price = 0;
            this.description = '';
        }
    }
    // grocery-list.service.ts
    import { Injectable } from '@angular/core';
    import GroceryList from '@app/interface/grocery-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class GroceryListService {
        private groceries: GroceryList[] = [];
    
        constructor() {}
    
        addGrocery(
            id: number,
            name: string,
            price: number,
            description: string,
        ): void {
            this.groceries.push({
                id: id,
                name: name,
                price: price,
                description: description,
            });
        }
    
        getGroceries(): GroceryList[] {
            return this.groceries;
        }
    }
    

  23. Classroom List:

    // classroom-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import ClassroomList from '@app/interface/classroom-list';
    import { ClassroomListService } from '@app/services/classroom-list/classroom-list.service';
    
    @Component({
        selector: 'app-classroom-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './classroom-list.component.html',
        styles: ``,
    })
    export class ClassroomListComponent {
        classroomList = [] as ClassroomList[];
        constructor(private classroomService: ClassroomListService) {
            this.classroomList = this.classroomService.getClassrooms();
        }
    
        id: number = 0;
        name: string = '';
        teacher: string = '';
        studentCount: number = 0;
    
        addNewClassroom() {
            this.classroomService.addClassroom(
                this.id,
                this.name,
                this.teacher,
                this.studentCount,
            );
            this.id = 0;
            this.name = '';
            this.teacher = '';
            this.studentCount = 0;
        }
    }
    // classroom-list.service.ts
    import { Injectable } from '@angular/core';
    import ClassroomList from '@app/interface/classroom-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class ClassroomListService {
        private classrooms: ClassroomList[] = [];
    
        constructor() {}
    
        addClassroom(
            id: number,
            name: string,
            teacher: string,
            studentCount: number,
        ): void {
            this.classrooms.push({
                id: id,
                name: name,
                teacher: teacher,
                studentCount: studentCount,
            });
        }
    
        getClassrooms(): ClassroomList[] {
            return this.classrooms;
        }
    }
    

  24. Inventory List:

    // inventory-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import InventoryList from '@app/interface/inventory-list';
    import { InventoryListService } from '@app/services/inventory-list/inventory-list.service';
    
    @Component({
        selector: 'app-inventory-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './inventory-list.component.html',
        styles: ``,
    })
    export class InventoryListComponent {
        inventoryList = [] as InventoryList[];
        constructor(private inventoryService: InventoryListService) {
            this.inventoryList = this.inventoryService.getInventories();
        }
    
        id: number = 0;
        name: string = '';
        quantity: number = 0;
        price: number = 0;
    
        addNewInventory() {
            this.inventoryService.addInventory(
                this.id,
                this.name,
                this.quantity,
                this.price,
            );
            this.id = 0;
            this.name = '';
            this.quantity = 0;
            this.price = 0;
        }
    }
    // inventory-list.service.ts
    import { Injectable } from '@angular/core';
    import InventoryList from '@app/interface/inventory-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class InventoryListService {
        private inventories: InventoryList[] = [];
    
        constructor() {}
    
        addInventory(
            id: number,
            name: string,
            price: number,
            quantity: number,
        ): void {
            this.inventories.push({
                id: id,
                name: name,
                price: price,
                quantity: quantity,
            });
        }
    
        getInventories(): InventoryList[] {
            return this.inventories;
        }
    }
    

  25. Lecture List:

    // lecture-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import LectureList from '@app/interface/lecture-list';
    import { LectureListService } from '@app/services/lecture-list/lecture-list.service';
    
    @Component({
        selector: 'app-lecture-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './lecture-list.component.html',
        styles: ``,
    })
    export class LectureListComponent {
        lectureList = [] as LectureList[];
        constructor(private lectureListService: LectureListService) {
            this.lectureList = this.lectureListService.getLectures();
        }
    
        id: number = 0;
        name: string = '';
        duration: number = 0;
        instructor: string = '';
    
        addLecture() {
            this.lectureListService.addLecture(
                this.id,
                this.name,
                this.duration,
                this.instructor,
            );
            this.id = 0;
            this.name = '';
            this.duration = 0;
            this.instructor = '';
        }
    }
    // lecture-list.service.ts
    import { Injectable } from '@angular/core';
    import LectureList from '@app/interface/lecture-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class LectureListService {
        private lectures: LectureList[] = [];
    
        constructor() {}
    
        addLecture(
            id: number,
            name: string,
            duration: number,
            instructor: string,
        ): void {
            this.lectures.push({
                id: id,
                name: name,
                duration: duration,
                instructor: instructor,
            });
        }
    
        getLectures(): LectureList[] {
            return this.lectures;
        }
    }
    

  26. Stationery List:

    // stationery-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import StationeryList from '@app/interface/stationery-list';
    import { StationeryListService } from '@app/services/stationery-list/stationery-list.service';
    
    @Component({
        selector: 'app-stationery-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './stationery-list.component.html',
        styles: ``,
    })
    export class StationeryListComponent {
        stationeryList = [] as StationeryList[];
        constructor(private stationeryListService: StationeryListService) {
            this.stationeryList = this.stationeryListService.getStationeries();
        }
    
        id: number = 0;
        name: string = '';
        quantity: number = 0;
        price: number = 0;
    
        addNewStationery() {
            this.stationeryListService.addStationery(
                this.id,
                this.name,
                this.quantity,
                this.price,
            );
            this.id = 0;
            this.name = '';
            this.quantity = 0;
            this.price = 0;
        }
    }
    // stationery-list.service.ts
    import { Injectable } from '@angular/core';
    import StationeryList from '@app/interface/stationery-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class StationeryListService {
        private stationeries: StationeryList[] = [];
    
        constructor() {}
    
        addStationery(
            id: number,
            name: string,
            price: number,
            quantity: number,
        ): void {
            this.stationeries.push({
                id: id,
                name: name,
                price: price,
                quantity: quantity,
            });
        }
    
        getStationeries(): StationeryList[] {
            return this.stationeries;
        }
    }
    

  27. Flower List:

    // flower-list.component.ts
    import { Component } from '@angular/core';
    import { FormsModule } from '@angular/forms';
    import { NgForOf } from '@angular/common';
    import FlowerList from '@app/interface/flower-list';
    import { FlowerListService } from '@app/services/flower-list/flower-list.service';
    
    @Component({
        selector: 'app-flower-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './flower-list.component.html',
        styles: ``,
    })
    export class FlowerListComponent {
        flowerList = [] as FlowerList[];
        constructor(private flowerListService: FlowerListService) {
            this.flowerList = this.flowerListService.getFlowers();
        }
    
        id: number = 0;
        name: string = '';
        description: string = '';
        price: number = 0;
        isAvailable: boolean = false;
        quantity: number = 0;
    
        addFlower() {
            this.flowerListService.addFlower(
                this.id,
                this.name,
                this.price,
                this.quantity,
                this.description,
                this.isAvailable,
            );
    
            this.id = 0;
            this.name = '';
            this.description = '';
            this.price = 0;
            this.isAvailable = false;
            this.quantity = 0;
        }
    }
    // flower-list.service.ts
    import { Injectable } from '@angular/core';
    import FlowerList from '@app/interface/flower-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class FlowerListService {
        private flowers: FlowerList[] = [];
    
        constructor() {}
    
        addFlower(
            id: number,
            name: string,
            price: number,
            quantity: number,
            description: string,
            isAvailable: boolean,
        ): void {
            this.flowers.push({
                id: id,
                name: name,
                description: description,
                price: price,
                isAvailable: isAvailable,
                quantity: quantity,
            });
        }
    
        getFlowers(): FlowerList[] {
            return this.flowers;
        }
    }
    

  28. Destination List:

    // destination-list.component.ts
    import { Component } from '@angular/core';
    import { FormsModule } from '@angular/forms';
    import { NgForOf } from '@angular/common';
    import DestinationList from '@app/interface/destination-list';
    import { DestinationListService } from '@app/services/desination-list/destination-list.service';
    
    @Component({
        selector: 'app-destination-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './destination-list.component.html',
        styles: ``,
    })
    export class DestinationListComponent {
        destinations = [] as DestinationList[];
        constructor(private destinationListService: DestinationListService) {
            this.destinations = this.destinationListService.getDestinations();
        }
    
        id: number = 0;
        name: string = '';
        description: string = '';
        location: string = '';
    
        addDestination() {
            this.destinationListService.addDestination(
                this.id,
                this.name,
                this.description,
                this.location,
            );
    
            this.id = 0;
            this.name = '';
            this.description = '';
            this.location = '';
        }
    }
    // destination-list.service.ts
    import { Injectable } from '@angular/core';
    import DestinationList from '@app/interface/destination-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class DestinationListService {
        private destinations: DestinationList[] = [];
    
        constructor() {}
    
        addDestination(
            id: number,
            name: string,
            description: string,
            location: string,
        ): void {
            this.destinations.push({
                id: id,
                name: name,
                description: description,
                location: location,
            });
        }
    
        getDestinations(): DestinationList[] {
            return this.destinations;
        }
    }
    

  29. Laptop List:

    // laptop-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import LaptopList from '@app/interface/laptop-list';
    import { LaptopListService } from '@app/services/laptop-list/laptop-list.service';
    
    @Component({
        selector: 'app-laptop-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './laptop-list.component.html',
        styles: ``,
    })
    export class LaptopListComponent {
        laptops = [] as LaptopList[];
    
        constructor(private laptopService: LaptopListService) {
            this.laptops = this.laptopService.getLaptops();
        }
    
        id: number = 0;
        model: string = '';
        brand: string = '';
        price: number = 0;
        processor: string = '';
        ram: string = '';
        storage: string = '';
        display: string = '';
        graphics: string = '';
    
        addLaptop() {
            this.laptopService.addLaptop(
                this.id,
                this.model,
                this.brand,
                this.price,
                this.processor,
                this.ram,
                this.storage,
                this.display,
                this.graphics,
            );
            this.id = 0;
            this.model = '';
            this.brand = '';
            this.price = 0;
            this.processor = '';
            this.ram = '';
            this.storage = '';
            this.display = '';
            this.graphics = '';
        }
    }
    // laptop-list.service.ts
    import { Injectable } from '@angular/core';
    import LaptopList from '@app/interface/laptop-list';
    
    @Injectable({
      providedIn: 'root'
    })
    export class LaptopListService {
      private laptops: LaptopList[] = [];
    
      constructor() { }
    
      addLaptop(
        id: number,
        model: string,
        brand: string,
        price: number,
        processor: string,
        ram: string,
        storage: string,
        display: string,
        graphics: string
      ): void {
        this.laptops.push({
          id: id,
          model: model,
          brand: brand,
          price: price,
          processor: processor,
          ram: ram,
          storage: storage,
          display: display,
          graphics: graphics,
        });
      }
    
      getLaptops(): LaptopList[] {
        return this.laptops;
      }
    }
    

  30. Laptop Specification List:

    // laptop-specification-list.component.ts
    import { Component } from '@angular/core';
    import { NgFor } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import LaptopSpecs from '@app/interface/laptop-specs-list';
    import { LaptopSpecificationListService } from '@app/services/laptop-specification-list/laptop-specification-list.service';
    
    @Component({
        selector: 'app-laptop-specification-list',
        standalone: true,
        imports: [NgFor, FormsModule],
        templateUrl: './laptop-specification-list.component.html',
        styles: ``,
    })
    export class LaptopSpecificationListComponent {
        laptops = [] as LaptopSpecs[];
    
        constructor(private laptopService: LaptopSpecificationListService) {
            this.laptops = this.laptopService.getLaptopSpecs();
        }
    
        model: string = '';
        processor: string = '';
        ram: string = '';
        storage: string = '';
        display: string = '';
        graphics: string = '';
    
        addLaptop() {
            this.laptops.push({
                model: this.model,
                specs: {
                    processor: this.processor,
                    ram: this.ram,
                    storage: this.storage,
                    display: this.display,
                    graphics: this.graphics,
                },
            });
            this.model = '';
            this.processor = '';
            this.ram = '';
            this.storage = '';
            this.display = '';
            this.graphics = '';
        }
    }
    // laptop-specification-list.service.ts
    import { Injectable } from '@angular/core';
    import LaptopSpecs from '@app/interface/laptop-specs-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class LaptopSpecificationListService {
        private laptopSpecs: LaptopSpecs[] = [];
    
        constructor() {}
    
        addLaptopSpecs(
            model: string,
            processor: string,
            ram: string,
            storage: string,
            display: string,
            graphics: string,
        ): void {
            this.laptopSpecs.push({
                model: model,
                specs: {
                    processor: processor,
                    ram: ram,
                    storage: storage,
                    display: display,
                    graphics: graphics,
                },
            });
        }
    
        getLaptopSpecs(): LaptopSpecs[] {
            return this.laptopSpecs;
        }
    }
    

  31. Computer Hardware List:

    // computer-hardware-list.component.ts
    import { Component } from '@angular/core';
    import { FormsModule } from '@angular/forms';
    import ComputerHardware from '@app/interface/computer-hardware-list';
    import { NgForOf } from '@angular/common';
    import { ComputerHardwareListService } from '@app/services/computer-hardware-list/computer-hardware-list.service';
    
    @Component({
        selector: 'app-computer-hardware-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './computer-hardware-list.component.html',
        styles: ``,
    })
    export class ComputerHardwareListComponent {
        computerHardware = [] as ComputerHardware[];
    
        constructor(
            private computerHardwareListService: ComputerHardwareListService,
        ) {
            this.computerHardware =
                this.computerHardwareListService.getComputerHardwares();
        }
    
        name: string = '';
        location: string = '';
        type: string = '';
        price: number = 0;
    
        addComputerHardware() {
            this.computerHardwareListService.addComputerHardware(
                this.name,
                this.location,
                this.type,
                this.price,
            );
    
            this.name = '';
            this.location = '';
            this.type = '';
            this.price = 0;
        }
    }
    // computer-hardware-list.service.ts
    import { Injectable } from '@angular/core';
    import ComputerHardware from '@app/interface/computer-hardware-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class ComputerHardwareListService {
        private computerHardwares: ComputerHardware[] = [];
    
        constructor() {}
    
        addComputerHardware(
            name: string,
            location: string,
            type: string,
            price: number,
        ): void {
            this.computerHardwares.push({
                name: name,
                location: location,
                type: type,
                price: price,
            });
        }
    
        getComputerHardwares(): ComputerHardware[] {
            return this.computerHardwares;
        }
    }
    

  32. Mobile App List:

    // mobile-app-list.component.ts
    import { Component } from '@angular/core';
    import MobileAppList from '@app/interface/mobile-app-list';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import { MobileAppListService } from '@app/services/mobile-app-list/mobile-app-list.service';
    
    @Component({
        selector: 'app-mobile-app-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './mobile-app-list.component.html',
        styles: ``,
    })
    export class MobileAppListComponent {
        mobileApps = [] as MobileAppList[];
    
        constructor(private mobileAppService: MobileAppListService) {
            this.mobileApps = this.mobileAppService.getMobileApps();
        }
    
        name: string = '';
        description: string = '';
        price: number = 0;
        rating: number = 0;
    
        addMobileApp() {
            this.mobileAppService.addMobileApp(
                this.name,
                this.description,
                this.price,
                this.rating,
            );
    
            this.name = '';
            this.description = '';
            this.price = 0;
            this.rating = 0;
        }
    }
    // mobile-app-list.service.ts
    import { Injectable } from '@angular/core';
    import MobileAppList from '@app/interface/mobile-app-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class MobileAppListService {
        private mobileApps: MobileAppList[] = [];
    
        constructor() {}
    
        addMobileApp(
            name: string,
            description: string,
            price: number,
            rating: number,
        ): void {
            this.mobileApps.push({
                name: name,
                description: description,
                price: price,
                rating: rating,
            });
        }
    
        getMobileApps(): MobileAppList[] {
            return this.mobileApps;
        }
    }
    

  33. Video List:

    // video-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import VideoList from '@app/interface/video-list';
    import { VideoListService } from '@app/services/video-list/video-list.service';
    
    @Component({
        selector: 'app-video-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './video-list.component.html',
        styles: ``,
    })
    export class VideoListComponent {
        videoList = [] as VideoList[];
        constructor(private videoService: VideoListService) {
            this.videoList = this.videoService.getVideos();
        }
        name: string = '';
        description: string = '';
        url: string = '';
        rating: number = 0;
        category: string = '';
    
        addVideo() {
            this.videoService.addVideo(
                this.name,
                this.description,
                this.url,
                this.rating,
                this.category,
            );
            this.name = '';
            this.description = '';
            this.url = '';
            this.rating = 0;
            this.category = '';
        }
    }
    // video-list.service.ts
    import { Injectable } from '@angular/core';
    import VideoList from '@app/interface/video-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class VideoListService {
        private videos: VideoList[] = [];
    
        constructor() {}
    
        addVideo(
            name: string,
            description: string,
            url: string,
            rating: number,
            category: string,
        ): void {
            this.videos.push({
                name: name,
                description: description,
                url: url,
                rating: rating,
                category: category,
            });
        }
    
        getVideos(): VideoList[] {
            return this.videos;
        }
    }
    

  34. Tv Show List:

    // tv-show-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import TvShowList from '@app/interface/tv-show-list';
    import { TvShowListService } from '@app/services/tx-show-list/tv-show-list.service';
    
    @Component({
        selector: 'app-tv-show-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './tv-show-list.component.html',
        styles: ``,
    })
    export class TvShowListComponent {
        tvShowList = [] as TvShowList[];
        constructor(private tvShowService: TvShowListService) {
            this.tvShowList = this.tvShowService.getTvShows();
        }
        name: string = '';
        description: string = '';
        url: string = '';
        rating: number = 0;
        category: string = '';
    
        addTvShow() {
            this.tvShowService.addTvShow(
                this.name,
                this.description,
                this.url,
                this.rating,
                this.category,
            );
            this.name = '';
            this.description = '';
            this.url = '';
            this.rating = 0;
            this.category = '';
        }
    }
    // tv-show-list.service.ts
    import { Injectable } from '@angular/core';
    import TvShowList from '@app/interface/tv-show-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class TvShowListService {
        private tvShows: TvShowList[] = [];
    
        constructor() {}
    
        addTvShow(
            name: string,
            description: string,
            url: string,
            rating: number,
            category: string,
        ): void {
            this.tvShows.push({
                name: name,
                description: description,
                url: url,
                rating: rating,
                category: category,
            });
        }
    
        getTvShows(): TvShowList[] {
            return this.tvShows;
        }
    }
    

  35. Furniture List:

    // furniture-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import FurnitureList from '@app/interface/furniture-list';
    import { FurnitureListService } from '@app/services/furniture-list/furniture-list.service';
    
    @Component({
        selector: 'app-furniture-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './furniture-list.component.html',
        styles: ``,
    })
    export class FurnitureListComponent {
        furnitureList = [] as FurnitureList[];
        constructor(private furnitureService: FurnitureListService) {
            this.furnitureList = this.furnitureService.getFurnitures();
        }
        name: string = '';
        description: string = '';
        type: string = '';
        price: number = 0;
        category: string = '';
    
        addFurniture() {
            this.furnitureService.addFurniture(
                this.name,
                this.description,
                this.type,
                this.price,
                this.category,
            );
            this.name = '';
            this.description = '';
            this.type = '';
            this.price = 0;
            this.category = '';
        }
    }
    // furniture-list.service.ts
    import { Injectable } from '@angular/core';
    import FurnitureList from '@app/interface/furniture-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class FurnitureListService {
        private furnitures: FurnitureList[] = [];
        constructor() {}
    
        addFurniture(
            name: string,
            description: string,
            type: string,
            price: number,
            category: string,
        ): void {
            this.furnitures.push({
                name: name,
                description: description,
                type: type,
                price: price,
                category: category,
            });
        }
    
        getFurnitures(): FurnitureList[] {
            return this.furnitures;
        }
    }
    

  36. Accessory List:

    // accessory-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import AccessoryList from '@app/interface/accessory-list';
    import { AccessoryListService } from '@app/services/accessory-list/accessory-list.service';
    
    @Component({
        selector: 'app-accessory-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './accessory-list.component.html',
        styles: ``,
    })
    export class AccessoryListComponent {
        accessoryList = [] as AccessoryList[];
        constructor(private accessoryService: AccessoryListService) {
            this.accessoryList = this.accessoryService.getAccessories();
        }
    
        name: string = '';
        description: string = '';
        price: number = 0;
    
        addAccessory() {
            this.accessoryService.addAccessory(
                this.name,
                this.description,
                this.price,
            );
    
            this.name = '';
            this.description = '';
            this.price = 0;
        }
    }
    // accessory-list.service.ts
    import { Injectable } from '@angular/core';
    import AccessoryList from '@app/interface/accessory-list';
    
    @Injectable({
      providedIn: 'root'
    })
    export class AccessoryListService {
      private accessories: AccessoryList[] = [];
    
      constructor() { }
    
      addAccessory(name: string, description: string, price: number): void {
        this.accessories.push({
          name: name,
          description: description,
          price: price,
        });
      }
    
      getAccessories(): AccessoryList[] {
        return this.accessories;
      }
    }
    

  37. Building List:

    // building-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import BuildingList from '@app/interface/building-list';
    import { BuildingListService } from '@app/services/bulding-list/building-list.service';
    
    @Component({
        selector: 'app-building-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './building-list.component.html',
        styles: ``,
    })
    export class BuildingListComponent {
        buildingList = [] as BuildingList[];
        constructor(private buildingService: BuildingListService) {
            this.buildingList = this.buildingService.getBuildings();
        }
    
        name: string = '';
        floors: number = 0;
        rooms: number = 0;
        occupants: number = 0;
    
        addBuilding() {
            this.buildingService.addBuilding(
                this.name,
                this.floors,
                this.rooms,
                this.occupants,
            );
    
            this.name = '';
            this.floors = 0;
            this.rooms = 0;
            this.occupants = 0;
        }
    }
    // building-list.service.ts
    import { Injectable } from '@angular/core';
    import BuildingList from '@app/interface/building-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class BuildingListService {
        private buildings: BuildingList[] = [];
    
        constructor() {}
    
        addBuilding(
            name: string,
            floors: number,
            rooms: number,
            occupants: number,
        ): void {
            this.buildings.push({
                name: name,
                floors: floors,
                rooms: rooms,
                occupants: occupants,
            });
        }
    
        getBuildings(): BuildingList[] {
            return this.buildings;
        }
    }
    

  38. Painting List:

    // painting-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import PaintingList from '@app/interface/painting-list';
    import { PaintingListService } from '@app/services/painting-list/painting-list.service';
    
    @Component({
        selector: 'app-painting-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './painting-list.component.html',
        styles: ``,
    })
    export class PaintingListComponent {
        paintingList = [] as PaintingList[];
        constructor(private paintingService: PaintingListService) {
            this.paintingList = this.paintingService.getPaintings();
        }
    
        title: string = '';
        artist: string = '';
        year: number = 0;
        price: number = 0;
    
        addPainting() {
            this.paintingService.addPainting(
                this.title,
                this.artist,
                this.year,
                this.price,
            );
            this.title = '';
            this.artist = '';
            this.year = 0;
            this.price = 0;
        }
    }
    // painting-list.service.ts
    import { Injectable } from '@angular/core';
    import PaintingList from '@app/interface/painting-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class PaintingListService {
        private paintings: PaintingList[] = [];
    
        constructor() {}
    
        addPainting(
            title: string,
            artist: string,
            year: number,
            price: number,
        ): void {
            this.paintings.push({
                title: title,
                artist: artist,
                year: year,
                price: price,
            });
        }
    
        getPaintings(): PaintingList[] {
            return this.paintings;
        }
    }
    

  39. Artist List:

    // artist-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import ArtistList from '@app/interface/artist-list';
    import { ArtistListService } from '@app/services/artist-list/artist-list.service';
    
    @Component({
        selector: 'app-artist-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './artist-list.component.html',
        styles: ``,
    })
    export class ArtistListComponent {
        artistList = [] as ArtistList[];
        constructor(private artistService: ArtistListService) {
            this.artistList = this.artistService.getArtists();
        }
    
        name: string = '';
        field: string = '';
        genre: string = '';
        country: string = '';
    
        addArtist() {
            this.artistService.addArtist(
                this.name,
                this.field,
                this.genre,
                this.country,
            );
            this.name = '';
            this.field = '';
            this.genre = '';
            this.country = '';
        }
    }
    // artist-list.service.ts
    import { Injectable } from '@angular/core';
    import ArtistList from '@app/interface/artist-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class ArtistListService {
        private artists: ArtistList[] = [];
    
        constructor() {}
    
        addArtist(
            name: string,
            field: string,
            genre: string,
            country: string,
        ): void {
            this.artists.push({
                name: name,
                field: field,
                genre: genre,
                country: country,
            });
        }
    
        getArtists(): ArtistList[] {
            return this.artists;
        }
    }
    

  40. Composer List:

    // composer-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import ComposerList from '@app/interface/composer-list';
    import { ComposerListService } from '@app/services/composer-list/composer-list.service';
    
    @Component({
        selector: 'app-composer-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './composer-list.component.html',
        styles: ``,
    })
    export class ComposerListComponent {
        composers = [] as ComposerList[];
        constructor(private composerService: ComposerListService) {
            this.composers = this.composerService.getComposers();
        }
    
        name: string = '';
        popularMusic: string = '';
        genre: string = '';
        country: string = '';
    
        addComposer() {
            this.composerService.addComposer(
                this.name,
                this.popularMusic,
                this.genre,
                this.country,
            );
    
            this.name = '';
            this.popularMusic = '';
            this.genre = '';
            this.country = '';
        }
    }
    // composer-list.service.ts
    import { Injectable } from '@angular/core';
    import ComposerList from '@app/interface/composer-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class ComposerListService {
        private composers: ComposerList[] = [];
    
        constructor() {}
    
        addComposer(
            name: string,
            popularMusic: string,
            genre: string,
            country: string,
        ): void {
            this.composers.push({
                name: name,
                popularMusic: popularMusic,
                genre: genre,
                country: country,
            });
        }
    
        getComposers(): ComposerList[] {
            return this.composers;
        }
    }
    

  41. Podcast List:

    // podcast-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import PodcastList from '@app/interface/podcast-list';
    import { PodcastListService } from '@app/services/podcast-list/podcast-list.service';
    
    @Component({
        selector: 'app-podcast-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './podcast-list.component.html',
        styles: ``,
    })
    export class PodcastListComponent {
        podcasts = [] as PodcastList[];
        constructor(private podcastService: PodcastListService) {
            this.podcasts = this.podcastService.getPodcasts();
        }
    
        name: string = '';
        host: string = '';
        genre: string = '';
        episodeNumber: number = 0;
    
        addPodcast() {
            this.podcastService.addPodcast(
                this.name,
                this.host,
                this.genre,
                this.episodeNumber,
            );
    
            this.name = '';
            this.host = '';
            this.genre = '';
            this.episodeNumber = 0;
        }
    }
    // podcast-list.service.ts
    import { Injectable } from '@angular/core';
    import PodcastList from '@app/interface/podcast-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class PodcastListService {
        private podcasts: PodcastList[] = [];
    
        constructor() {}
    
        addPodcast(
            name: string,
            host: string,
            genre: string,
            episodeNumber: number,
        ): void {
            this.podcasts.push({
                name: name,
                host: host,
                genre: genre,
                episodeNumber: episodeNumber,
            });
        }
    
        getPodcasts(): PodcastList[] {
            return this.podcasts;
        }
    }
    

  42. Exercise List:

    // exercise-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import ExerciseList from '@app/interface/exercise-list';
    import { ExerciseListService } from '@app/services/exercise-list/exerciselist.service';
    
    @Component({
        selector: 'app-exercise-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './exercise-list.component.html',
        styles: ``,
    })
    export class ExerciseListComponent {
        exercises = [] as ExerciseList[];
        constructor(private exerciseService: ExerciseListService) {
            this.exercises = this.exerciseService.getExercises();
        }
        name: string = '';
        sets: number = 0;
        reps: number = 0;
        weight: number = 0;
    
        addExercise() {
            this.exerciseService.addExercise(
                this.name,
                this.sets,
                this.reps,
                this.weight,
            );
    
            this.name = '';
            this.sets = 0;
            this.reps = 0;
            this.weight = 0;
        }
    }
    // exercise-list.service.ts
    import { Injectable } from '@angular/core';
    import ExerciseList from '@app/interface/exercise-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class ExerciseListService {
        private exercises: ExerciseList[] = [];
    
        constructor() {}
    
        addExercise(
            name: string,
            sets: number,
            reps: number,
            weight: number,
        ): void {
            this.exercises.push({
                name: name,
                sets: sets,
                reps: reps,
                weight: weight,
            });
        }
    
        getExercises(): ExerciseList[] {
            return this.exercises;
        }
    }
    

  43. Meal Plan List:

    // meal-plan-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import { MealPlanListService } from '@app/services/meal-plan-list/meal-plan-list.service';
    import MealPlanList from '@app/interface/meal-plan-list';
    
    @Component({
        selector: 'app-meal-plan-list',
        standalone: true,
        imports: [NgForOf, FormsModule],
        templateUrl: './meal-plan-list.component.html',
        styles: ``,
    })
    export class MealPlanListComponent {
        meals = [] as MealPlanList[];
        constructor(private mealPlanService: MealPlanListService) {
            this.meals = this.mealPlanService.getMeals();
        }
    
        name: string = '';
        breakfast: string = '';
        lunch: string = '';
        dinner: string = '';
        snack: string = '';
        drink: string = '';
    
        addMealPlan() {
            this.mealPlanService.addMealPlan(
                this.name,
                this.breakfast,
                this.lunch,
                this.dinner,
                this.snack,
                this.drink,
            );
    
            this.name = '';
            this.breakfast = '';
            this.lunch = '';
            this.dinner = '';
            this.snack = '';
            this.drink = '';
        }
    }
    // meal-plan-list.service.ts
    import { Injectable } from '@angular/core';
    import MealPlanList from '@app/interface/meal-plan-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class MealPlanListService {
        private mealPlans: MealPlanList[] = [];
    
        constructor() {}
    
        addMealPlan(
            name: string,
            breakfast: string,
            lunch: string,
            dinner: string,
            snack: string,
            drink: string,
        ): void {
            this.mealPlans.push({
                name: name,
                breakfast: breakfast,
                lunch: lunch,
                dinner: dinner,
                snack: snack,
                drink: drink,
            });
        }
    
        getMeals(): MealPlanList[] {
            return this.mealPlans;
        }
    }
    

  44. Budget List:

    // budget-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import BudgetList from '@app/interface/budget-list';
    import { BudgetListService } from '@app/services/budget-list/budget-list.service';
    
    @Component({
        selector: 'app-budget-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './budget-list.component.html',
        styles: ``,
    })
    export class BudgetListComponent {
        budgets = [] as BudgetList[];
        constructor(private budgetListService: BudgetListService) {
            this.budgets = this.budgetListService.getBudgets();
        }
        project: string = '';
        budget: number = 0;
        status: string = '';
        startDate: string = '';
        endDate: string = '';
    
        addBudget() {
            this.budgetListService.addBudget(
                this.project,
                this.budget,
                this.status,
                this.startDate,
                this.endDate,
            );
    
            this.project = '';
            this.budget = 0;
            this.status = '';
            this.startDate = '';
            this.endDate = '';
        }
    }
    // budget-list.service.ts
    import { Injectable } from '@angular/core';
    import BudgetList from '@app/interface/budget-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class BudgetListService {
        private budgets: BudgetList[] = [];
    
        constructor() {}
    
        addBudget(
            project: string,
            budget: number,
            status: string,
            startDate: string,
            endDate: string,
        ): void {
            this.budgets.push({
                project: project,
                budget: budget,
                status: status,
                startDate: startDate,
                endDate: endDate,
            });
        }
    
        getBudgets(): BudgetList[] {
            return this.budgets;
        }
    }
    

  45. Presentation List:

    // presentation-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import PresentationList from '@app/interface/presentation-list';
    import { PresentationListService } from '@app/services/presentation-list/presentation-list.service';
    
    @Component({
        selector: 'app-presentation-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './presentation-list.component.html',
        styles: ``,
    })
    export class PresentationListComponent {
        presentations = [] as PresentationList[];
        constructor(private presentationService: PresentationListService) {
            this.presentations = this.presentationService.getPresentations();
        }
    
        topic: string = '';
        presenter: string = '';
        date: string = '';
        time: string = '';
    
        addPresentation() {
            this.presentationService.addPresentation(
                this.topic,
                this.presenter,
                this.date,
                this.time,
            );
    
            this.topic = '';
            this.presenter = '';
            this.date = '';
            this.time = '';
        }
    }
    // presentation-list.service.ts
    import { Injectable } from '@angular/core';
    import PresentationList from '@app/interface/presentation-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class PresentationListService {
        private presentations: PresentationList[] = [];
    
        constructor() {}
    
        addPresentation(
            topic: string,
            presenter: string,
            date: string,
            time: string,
        ): void {
            this.presentations.push({
                topic: topic,
                presenter: presenter,
                date: date,
                time: time,
            });
        }
    
        getPresentations(): PresentationList[] {
            return this.presentations;
        }
    }
    

  46. Tour List:

    // tour-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import TourList from '@app/interface/tour-list';
    import { TourListService } from '@app/services/tour-list/tour-list.service';
    
    @Component({
        selector: 'app-tour-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './tour-list.component.html',
        styles: ``,
    })
    export class TourListComponent {
        tours = [] as TourList[];
        constructor(private tourService: TourListService) {
            this.tours = this.tourService.getTours();
        }
    
        tourDate: string = '';
        tourName: string = '';
        tourLocation: string = '';
        tourPrice: number = 0;
        tourDuration: string = '';
    
        addTour() {
            this.tourService.addTour(
                this.tourDate,
                this.tourName,
                this.tourLocation,
                this.tourPrice,
                this.tourDuration,
            );
    
            this.tourDate = '';
            this.tourName = '';
            this.tourLocation = '';
            this.tourPrice = 0;
            this.tourDuration = '';
        }
    }
    // tour-list.service.ts
    import { Injectable } from '@angular/core';
    import TourList from '@app/interface/tour-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class TourListService {
        private tours: TourList[] = [];
    
        constructor() {}
    
        addTour(
            tourDate: string,
            tourName: string,
            tourLocation: string,
            tourPrice: number,
            tourDuration: string,
        ): void {
            this.tours.push({
                tourDate: tourDate,
                tourName: tourName,
                tourLocation: tourLocation,
                tourPrice: tourPrice,
                tourDuration: tourDuration,
            });
        }
    
        getTours(): TourList[] {
            return this.tours;
        }
    }
    

  47. Event List:

    // event-list.component.ts
    import { Component } from '@angular/core';
    import { NgForOf } from '@angular/common';
    import { FormsModule } from '@angular/forms';
    import EventList from '@app/interface/event-list';
    import { EventListService } from '@app/services/event-list/event-list.service';
    
    @Component({
        selector: 'app-event-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './event-list.component.html',
        styles: ``,
    })
    export class EventListComponent {
        events = [] as EventList[];
        constructor(private eventService: EventListService) {
            this.events = this.eventService.getEvents();
        }
    
        eventDate: string = '';
        eventName: string = '';
        eventLocation: string = '';
        eventPrice: number = 0;
        eventDuration: string = '';
    
        addEvent() {
            this.eventService.addEvent(
                this.eventDate,
                this.eventName,
                this.eventLocation,
                this.eventPrice,
                this.eventDuration
            );
    
            this.eventDate = '';
            this.eventName = '';
            this.eventLocation = '';
            this.eventPrice = 0;
            this.eventDuration = '';
        }
    }
    // event-list.service.ts
    import { Injectable } from '@angular/core';
    import EventList from '@app/interface/event-list';
    
    @Injectable({
      providedIn: 'root'
    })
    export class EventListService {
      private events: EventList[] = [];
    
      constructor() { }
    
      addEvent(    eventDate: string,
        eventName: string,
        eventLocation: string,
        eventPrice: number,
        eventDuration: string,): void {
        this.events.push({
          eventDate: eventDate,
          eventName: eventName,
          eventLocation: eventLocation,
          eventPrice: eventPrice,
          eventDuration: eventDuration,
        });
      }
    
      getEvents(): EventList[] {
        return this.events;
      }
    }
    

  48. Developer Tools List:

    // developer-tools-list.service.ts
    import { NgForOf } from '@angular/common';
    import { Component } from '@angular/core';
    import { FormsModule } from '@angular/forms';
    import DeveloperToolsList from '@app/interface/developer-tools-list';
    import { DeveloperToolsListService } from '@app/services/developer-tools-list/developer-tools-list.service';
    
    @Component({
        selector: 'app-developer-tools-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './developer-tools-list.component.html',
        styles: ``,
    })
    export class DeveloperToolsListComponent {
        developerTools = [] as DeveloperToolsList[];
        constructor(private developerToolsService: DeveloperToolsListService) {
            this.developerTools = this.developerToolsService.getDeveloperTools();
        }
    
        toolName: string = '';
        toolDescription: string = '';
        toolPrice: number = 0;
        toolDuration: string = '';
    
        addDeveloperTool() {
            this.developerToolsService.addDeveloperTool(
                this.toolName,
                this.toolDescription,
                this.toolPrice,
                this.toolDuration,
            );
    
            this.toolName = '';
            this.toolDescription = '';
            this.toolPrice = 0;
            this.toolDuration = '';
        }
    }
    // developer-tools-list.component.ts
    import { Injectable } from '@angular/core';
    import DeveloperToolsList from '@app/interface/developer-tools-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class DeveloperToolsListService {
        private developerTools: DeveloperToolsList[] = [];
    
        constructor() {}
    
        addDeveloperTool(
            toolName: string,
            toolDescription: string,
            toolPrice: number,
            toolDuration: string,
        ): void {
            this.developerTools.push({
                toolName: toolName,
                toolDescription: toolDescription,
                toolPrice: toolPrice,
                toolDuration: toolDuration,
            });
        }
    
        getDeveloperTools(): DeveloperToolsList[] {
            return this.developerTools;
        }
    }
    

  49. Framework List:

    // framework-list.component.ts
    import { Component } from '@angular/core';
    import { FormsModule } from '@angular/forms';
    import { NgForOf } from '@angular/common';
    import FrameworkList from '@app/interface/framework-list';
    import { FrameworkListService } from '@app/services/framework-list/framework-list.service';
    
    @Component({
        selector: 'app-framework-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './framework-list.component.html',
        styles: ``,
    })
    export class FrameworkListComponent {
        frameworks = [] as FrameworkList[];
        constructor(private frameworkService: FrameworkListService) {
            this.frameworks = this.frameworkService.getFrameworks();
        }
    
        name: string = '';
        description: string = '';
        developedBy: string = '';
        firstRelease: string = '';
        latestRelease: string = '';
    
        addFramework() {
            this.frameworkService.addFramework(
                this.name,
                this.description,
                this.developedBy,
                this.firstRelease,
                this.latestRelease,
            );
    
            this.name = '';
            this.description = '';
            this.developedBy = '';
            this.firstRelease = '';
            this.latestRelease = '';
        }
    }
    // framework-list.service.ts
    import { Injectable } from '@angular/core';
    import FrameworkList from '@app/interface/framework-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class FrameworkListService {
        private frameworks: FrameworkList[] = [];
    
        constructor() {}
    
        addFramework(
            name: string,
            description: string,
            developedBy: string,
            firstRelease: string,
            latestRelease: string,
        ): void {
            this.frameworks.push({
                name: name,
                description: description,
                developedBy: developedBy,
                firstRelease: firstRelease,
                latestRelease: latestRelease,
            });
        }
    
        getFrameworks(): FrameworkList[] {
            return this.frameworks;
        }
    }
    

  50. Library List:

    // library-list.component.ts
    import { Component } from '@angular/core';
    import { FormsModule } from '@angular/forms';
    import { NgForOf } from '@angular/common';
    import LibraryList from '@app/interface/library-list';
    import { LibraryListService } from '@app/services/library-list/library-list.service';
    
    @Component({
        selector: 'app-library-list',
        standalone: true,
        imports: [FormsModule, NgForOf],
        templateUrl: './library-list.component.html',
        styles: ``,
    })
    export class LibraryListComponent {
        libraries = [] as LibraryList[];
        constructor(private libraryService: LibraryListService) {
            this.libraries = this.libraryService.getLibraries();
        }
    
        libraryName: string = '';
        programmingLanguage: string = '';
        description: string = '';
        developedBy: string = '';
        firstRelease: string = '';
        latestRelease: string = '';
    
        addLibrary() {
            this.libraryService.addLibrary(
                this.libraryName,
                this.programmingLanguage,
                this.description,
                this.developedBy,
                this.firstRelease,
                this.latestRelease,
            );
    
            this.libraryName = '';
            this.programmingLanguage = '';
            this.description = '';
            this.developedBy = '';
            this.firstRelease = '';
            this.latestRelease = '';
        }
    }
    // library-list.service.ts
    import { Injectable } from '@angular/core';
    import LibraryList from '@app/interface/library-list';
    
    @Injectable({
        providedIn: 'root',
    })
    export class LibraryListService {
        private libraries: LibraryList[] = [];
    
        constructor() {}
    
        addLibrary(
            libraryName: string,
            programmingLanguage: string,
            description: string,
            developedBy: string,
            firstRelease: string,
            latestRelease: string,
        ): void {
            this.libraries.push({
                libraryName: libraryName,
                programmingLanguage: programmingLanguage,
                description: description,
                developedBy: developedBy,
                firstRelease: firstRelease,
                latestRelease: latestRelease,
            });
        }
    
        getLibraries(): LibraryList[] {
            return this.libraries;
        }
    }
    

    Repository Link: https://github.com/froilanimnida/activity-15-angular-with-typescript-and-data-structures

1
Subscribe to my newsletter

Read articles from froilan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

froilan
froilan