refactor
This commit is contained in:
parent
9a45f5099a
commit
0a147afca0
@ -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 *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'
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user