refactor(app): simplify hotel item rendering logic
All checks were successful
Build / Build and analyze (push) Successful in 1m40s
All checks were successful
Build / Build and analyze (push) Successful in 1m40s
This commit is contained in:
parent
e50c5686db
commit
4f1c0b6e2e
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
@ -1,7 +1,2 @@
|
|||||||
<h1>{{'hello' | uppercase | text}}</h1>
|
<h1>{{'hello' | uppercase | text}}</h1>
|
||||||
<app-search [(input)]="search"></app-search>
|
<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 { TextPipe } from '../text.pipe';
|
||||||
import { HotelService } from './Parent/services/hotel.service';
|
import { HotelService } from './Parent/services/hotel.service';
|
||||||
import { inject } from '@angular/core';
|
import { inject } from '@angular/core';
|
||||||
import { filter, map, Observable, range } from 'rxjs';
|
import { filter, from, map, Observable, range, tap, toArray } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -20,20 +20,18 @@ export class AppComponent {
|
|||||||
public hotelService: HotelService = inject(HotelService);
|
public hotelService: HotelService = inject(HotelService);
|
||||||
|
|
||||||
ngOnInit() {
|
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(
|
stream.pipe(
|
||||||
filter((value: number) => value % 2 === 1),
|
filter((value) => typeof value === "number"),
|
||||||
).subscribe((value) => console.log(value));
|
tap((value) => console.log("Zahl:" + value)),
|
||||||
console.log('---')
|
filter((value: number) => value % 2 === 0),
|
||||||
|
tap((value) => console.log("Gerade Zahl: " + value)),
|
||||||
stream.pipe(
|
toArray(),
|
||||||
map((value: number) => value * 2)
|
).subscribe(console.log);
|
||||||
).subscribe((value) => console.log(value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public test() {
|
public test() {
|
||||||
8
|
|
||||||
console.log(this.search);
|
console.log(this.search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user