Skip to content
Snippets Groups Projects
Commit 1da8d955 authored by hugcubi's avatar hugcubi
Browse files

Primer ejemplo funcional de añadir reserva

parent b1c76e1e
Branches
Tags
2 merge requests!10Add ts types and json mocks, remove poblate scripts and fix the cascade...,!9Dev booking request
......@@ -4,8 +4,8 @@ import { routes } from './app.routes';
import { provideClientHydration } from '@angular/platform-browser';
import { provideHttpClient, withFetch } from '@angular/common/http';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { importProvidersFrom } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { ReactiveFormsModule } from '@angular/forms'; // Added import for ReactiveFormsModule
export const appConfig: ApplicationConfig = {
providers: [
......@@ -14,6 +14,7 @@ export const appConfig: ApplicationConfig = {
provideClientHydration(),
provideHttpClient(withFetch()),
provideAnimationsAsync(),
ReactiveFormsModule // Asegúrate de incluir ReactiveFormsModule
ReactiveFormsModule
],
};
......@@ -5,7 +5,6 @@
<label for="userId">ID del Usuario:</label>
<input type="number" id="userId" formControlName="userId" class="form-control" />
</div>
<div class="form-group">
<label for="hotelId">ID del Hotel:</label>
<input type="number" id="hotelId" formControlName="hotelId" class="form-control" />
......
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ReactiveFormsModule, FormGroup, FormBuilder, Validators } from '@angular/forms';
interface BookingRequest {
userId: number; // ID del usuario que realiza la reserva
hotelId: number; // ID del hotel en el que se realiza la reserva
......@@ -10,10 +10,13 @@ interface BookingRequest {
import { BookingService } from '../booking.service'; // Asegúrate de que el servicio exista
@Component({
standalone : true,
imports : [ReactiveFormsModule],
selector: 'app-booking',
templateUrl: './booking.component.html',
styleUrls: ['./booking.component.css']
})
export class BookingComponent implements OnInit {
bookingForm: FormGroup;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment