import { Component, input } from '@angular/core'; import { HotelItem } from './HotelItem/HotelItem.component'; import { SearchComponent } from './Search/search.component'; import { UpperCasePipe } from '@angular/common'; import { TextPipe } from '../text.pipe'; import { HotelService } from './Parent/services/hotel.service'; import { inject } from '@angular/core'; @Component({ selector: 'app-root', standalone: true, imports: [HotelItem, SearchComponent, UpperCasePipe, TextPipe], templateUrl: './app.component.html', providers: [HotelService], styleUrl: './app.component.css' }) export class AppComponent { public search: string = ""; public hotelService: HotelService = inject(HotelService); public test() { console.log(this.search); } public has_hotels(): boolean { for (let hotel of this.hotels) { if (hotel.hotelName.includes(this.search)) { return true; } } return false; } public hotels = this.hotelService.getHotels(); }