This commit is contained in:
Constantin Simonis 2025-01-28 09:13:20 +01:00
parent 9a45f5099a
commit 0a147afca0
Signed by: csimonis
GPG Key ID: 758DD9C506603183

View File

@ -4,8 +4,8 @@ import {Hotel} from "../model/hotel";
import {FormsModule} from "@angular/forms";
import {Lang} from "../../currency/lang";
import {HotelService} from "../service/hotel.service";
import {filter, Observable, toArray} from "rxjs";
import {AsyncPipe} from "@angular/common";
import {Observable} from "rxjs";
import {AsyncPipe, NgIf} from "@angular/common";
import {CurrencyComponent} from "../../currency/currency.component";
import {RouterLink} from "@angular/router";
import {StarComponent} from "./star.component";
@ -19,16 +19,18 @@ import {StarComponent} from "./star.component";
</form>
<p routerLink="/hotels/new">Create Hotel</p>
@for (hotel of (matchingHotels | async); track hotel.id) {
<div>{{hotel.hotelName}}</div>
<img src="{{hotel.imageUrl}}" alt="{{hotel.hotelName}}" height="64" width="64">
<br>
<button routerLink="{{hotel.id}}">Details</button>
<hr>
<div *ngIf="hotel.hotelName.toLowerCase().includes(search)">
<div>{{ hotel.hotelName }}</div>
<img src="{{hotel.imageUrl}}" alt="{{hotel.hotelName}}" height="64" width="64">
<br>
<button routerLink="{{hotel.id}}">Details</button>
<hr>
</div>
} @empty {
<h1>no matching results for {{ search }}</h1>
}
`,
imports: [FormsModule, HotelComponent, AsyncPipe, CurrencyComponent, RouterLink, StarComponent],
imports: [FormsModule, HotelComponent, AsyncPipe, CurrencyComponent, RouterLink, StarComponent, NgIf],
providers: [HotelService],
selector: 'app-hotels'
})