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
No related branches found
No related tags found
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'; ...@@ -4,8 +4,8 @@ import { routes } from './app.routes';
import { provideClientHydration } from '@angular/platform-browser'; import { provideClientHydration } from '@angular/platform-browser';
import { provideHttpClient, withFetch } from '@angular/common/http'; import { provideHttpClient, withFetch } from '@angular/common/http';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'; import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { importProvidersFrom } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; // Added import for ReactiveFormsModule
import { ReactiveFormsModule } from '@angular/forms';
export const appConfig: ApplicationConfig = { export const appConfig: ApplicationConfig = {
providers: [ providers: [
...@@ -14,6 +14,7 @@ export const appConfig: ApplicationConfig = { ...@@ -14,6 +14,7 @@ export const appConfig: ApplicationConfig = {
provideClientHydration(), provideClientHydration(),
provideHttpClient(withFetch()), provideHttpClient(withFetch()),
provideAnimationsAsync(), provideAnimationsAsync(),
ReactiveFormsModule // Asegúrate de incluir ReactiveFormsModule ReactiveFormsModule
], ],
}; };
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
<label for="userId">ID del Usuario:</label> <label for="userId">ID del Usuario:</label>
<input type="number" id="userId" formControlName="userId" class="form-control" /> <input type="number" id="userId" formControlName="userId" class="form-control" />
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="hotelId">ID del Hotel:</label> <label for="hotelId">ID del Hotel:</label>
<input type="number" id="hotelId" formControlName="hotelId" class="form-control" /> <input type="number" id="hotelId" formControlName="hotelId" class="form-control" />
... ...
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { ReactiveFormsModule, FormGroup, FormBuilder, Validators } from '@angular/forms';
interface BookingRequest { interface BookingRequest {
userId: number; // ID del usuario que realiza la reserva userId: number; // ID del usuario que realiza la reserva
hotelId: number; // ID del hotel en el que se realiza la reserva hotelId: number; // ID del hotel en el que se realiza la reserva
...@@ -10,10 +10,13 @@ interface BookingRequest { ...@@ -10,10 +10,13 @@ interface BookingRequest {
import { BookingService } from '../booking.service'; // Asegúrate de que el servicio exista import { BookingService } from '../booking.service'; // Asegúrate de que el servicio exista
@Component({ @Component({
standalone : true,
imports : [ReactiveFormsModule],
selector: 'app-booking', selector: 'app-booking',
templateUrl: './booking.component.html', templateUrl: './booking.component.html',
styleUrls: ['./booking.component.css'] styleUrls: ['./booking.component.css']
}) })
export class BookingComponent implements OnInit { export class BookingComponent implements OnInit {
bookingForm: FormGroup; bookingForm: FormGroup;
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment