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