refactor(app): simplify hotel item rendering logic
All checks were successful
Build / Build and analyze (push) Successful in 1m40s

This commit is contained in:
Jan Gleytenhoover 2024-10-22 08:32:18 +02:00
parent e50c5686db
commit 4f1c0b6e2e
Signed by: jank
GPG Key ID: B267751B8AE29EFE
3 changed files with 8 additions and 15 deletions

BIN
bun.lockb

Binary file not shown.

@ -1,7 +1,2 @@
<h1>{{'hello' | uppercase | text}}</h1>
<app-search [(input)]="search"></app-search>
@for (let hotel of foundHotels | async) {
@if (search === "") {
<app-hotel-item [hotel]="hotel"></app-hotel-item>
}
}

@ -5,7 +5,7 @@ import { AsyncPipe, UpperCasePipe } from '@angular/common';
import { TextPipe } from '../text.pipe';
import { HotelService } from './Parent/services/hotel.service';
import { inject } from '@angular/core';
import { filter, map, Observable, range } from 'rxjs';
import { filter, from, map, Observable, range, tap, toArray } from 'rxjs';
@Component({
selector: 'app-root',
@ -20,20 +20,18 @@ export class AppComponent {
public hotelService: HotelService = inject(HotelService);
ngOnInit() {
const stream: Observable<number> = range(1, 10);
const stream: Observable<number | string> = from([5, 1, 2, 12, 5, 14, 17, 5, "testing"]);
stream.pipe(
filter((value: number) => value % 2 === 1),
).subscribe((value) => console.log(value));
console.log('---')
stream.pipe(
map((value: number) => value * 2)
).subscribe((value) => console.log(value));
filter((value) => typeof value === "number"),
tap((value) => console.log("Zahl:" + value)),
filter((value: number) => value % 2 === 0),
tap((value) => console.log("Gerade Zahl: " + value)),
toArray(),
).subscribe(console.log);
}
public test() {
8
console.log(this.search);
}