diff --git a/angular.json b/angular.json index 168f33f..0529da2 100644 --- a/angular.json +++ b/angular.json @@ -24,7 +24,8 @@ { "glob": "**/*", "input": "public" - } + }, + "src/assets" ], "styles": [ "src/styles.css" diff --git a/src/app/HotelItem/HotelItem.component.html b/src/app/HotelItem/HotelItem.component.html new file mode 100644 index 0000000..794b874 --- /dev/null +++ b/src/app/HotelItem/HotelItem.component.html @@ -0,0 +1,5 @@ +

Name: {{hotel.hotelName}}

+

Description: {{hotel.description}}

+

Price: {{hotel.price}}$

+Hotel +

{{hotel.rating}}

diff --git a/src/app/HotelItem/HotelItem.component.ts b/src/app/HotelItem/HotelItem.component.ts new file mode 100644 index 0000000..c15a1e8 --- /dev/null +++ b/src/app/HotelItem/HotelItem.component.ts @@ -0,0 +1,14 @@ +import { Component } from "@angular/core"; +import { ChildComponent } from "../Child/child.component"; +import { Input } from "@angular/core"; +import { Hotel } from "./hotel"; + +@Component({ + selector: 'app-hotel-item', + standalone: true, + templateUrl: './HotelItem.component.html', + imports: [ChildComponent], +}) +export class HotelItem { + @Input() public hotel!: Hotel; +} diff --git a/src/app/HotelItem/hotel.ts b/src/app/HotelItem/hotel.ts new file mode 100644 index 0000000..f098c6f --- /dev/null +++ b/src/app/HotelItem/hotel.ts @@ -0,0 +1,8 @@ +export interface Hotel { + hotelId: number; + hotelName: String; + description: String; + price: number; + imageUrl: String; + rating: number; +} diff --git a/src/app/Search/search.component.html b/src/app/Search/search.component.html new file mode 100644 index 0000000..3cc856a --- /dev/null +++ b/src/app/Search/search.component.html @@ -0,0 +1 @@ + diff --git a/src/app/Search/search.component.ts b/src/app/Search/search.component.ts new file mode 100644 index 0000000..c3564a0 --- /dev/null +++ b/src/app/Search/search.component.ts @@ -0,0 +1,20 @@ +import { CommonModule } from "@angular/common"; +import { Component, NgModule } from "@angular/core"; +import { FormsModule, NgForm, NgModel } from "@angular/forms"; +import { Input, Output } from "@angular/core"; +import { EventEmitter } from "@angular/core"; + +@Component({ + selector: 'app-search', + standalone: true, + templateUrl: './search.component.html', + imports: [FormsModule], +}) +export class SearchComponent { + @Input() public input: string = ""; + @Output() inputChange = new EventEmitter(); + + public update(e: string) { + this.inputChange.emit(e); + } +} diff --git a/src/app/app.component.html b/src/app/app.component.html index 5a4e9d4..ccd0872 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1 +1,4 @@ - + +
+ +
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 76cafff..e1c43ab 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,19 +1,55 @@ -import { Component } from '@angular/core'; -import { ParentComponent } from './Parent/parent.component'; -import { ChildComponent } from './Child/child.component'; +import { Component, input } from '@angular/core'; +import { HotelItem } from './HotelItem/HotelItem.component'; +import { CommonModule } from '@angular/common'; +import { SearchComponent } from './Search/search.component'; @Component({ selector: 'app-root', standalone: true, - imports: [ParentComponent, ChildComponent], + imports: [HotelItem, CommonModule, SearchComponent], templateUrl: './app.component.html', styleUrl: './app.component.css' }) export class AppComponent { - public test = "Hello"; + public search: string = ""; - public get age() { - return 17; + public test() { + console.log(this.search); } + + public hotels = [ + { + "hotelId": 1, + "hotelName": "Buea süßes Leben", + "description": "Schöne Aussicht am Meer", + "price": 230.5, + "imageUrl": "assets/img/1.jpg", + "rating": 3.5 + }, + { + "hotelId": 2, + "hotelName": "Marrakesch", + "description": "Genießen Sie den Blick auf die Berge", + "price": 145.5, + "imageUrl": "assets/img/2.jpg", + "rating": 5 + }, + { + "hotelId": 3, + "hotelName": "Abuja neuer Palast", + "description": "Kompletter Aufenthalt mit Autoservice", + "price": 120.12, + "imageUrl": "assets/img/3.jpg", + "rating": 4 + }, + { + "hotelId": 4, + "hotelName": "Kapstadt Stadt", + "description": "Wunderschönes Ambiente für Ihren Aufenthalt", + "price": 135.12, + "imageUrl": "assets/img/4.jpg", + "rating": 2.5 + } + ] } diff --git a/src/assets/img/1.jpg b/src/assets/img/1.jpg new file mode 100644 index 0000000..cbe7fae Binary files /dev/null and b/src/assets/img/1.jpg differ diff --git a/src/assets/img/2.jpg b/src/assets/img/2.jpg new file mode 100644 index 0000000..220e777 Binary files /dev/null and b/src/assets/img/2.jpg differ diff --git a/src/assets/img/3.jpg b/src/assets/img/3.jpg new file mode 100644 index 0000000..40ca2dc Binary files /dev/null and b/src/assets/img/3.jpg differ diff --git a/src/assets/img/4.jpg b/src/assets/img/4.jpg new file mode 100644 index 0000000..f5401fb Binary files /dev/null and b/src/assets/img/4.jpg differ diff --git a/src/assets/img/5.jpg b/src/assets/img/5.jpg new file mode 100644 index 0000000..73fbfa6 Binary files /dev/null and b/src/assets/img/5.jpg differ