This commit is contained in:
2024-11-20 11:10:57 +01:00
parent 20c04abe4f
commit 01de60aacb
5 changed files with 119 additions and 39 deletions

View File

@ -1,35 +1,21 @@
import { Component } from '@angular/core';
import {FormsModule} from "@angular/forms";
import {Component} from "@angular/core";
import {Hotel} from "./hotel";
import {HotelService} from "../service/hotel.service";
@Component({
selector: 'app-create-hotel',
selector: "app-create-hotel",
standalone: true,
imports: [
FormsModule
],
template: `
<ng-form>
<label for="name">Name</label>
<br>
<input id="name" type="text">
<br>
<label for="description">Description</label>
<br>
<input id="description" type="text">
<br>
<label for="price">Price</label>
<br>
<input id="price" type="number">
<br>
<label for="rating">Rating</label>
<br>
<input id="rating" type="number">
<br>
<br>
<button type="submit">Submit</button>
</ng-form>
`,
<app-create-hotel (updateHotel)="create($event)" />
`
})
export class CreateHotelComponent {
protected hotelService: HotelService;
create(hotel: Hotel) {
console.log(hotel)
this.hotelService.createHotel(hotel).subscribe(console.log)
}
}