update form from create book

This commit is contained in:
2025-11-10 16:21:26 +01:00
parent 76b6f74086
commit 549d841a02
4 changed files with 27 additions and 17 deletions

View File

@@ -1,33 +1,37 @@
<form nz-form nzLayout="horizontal" [formGroup]="authorForm" (ngSubmit)="submitForm()"> <form nz-form nzLayout="horizontal" [formGroup]="createBookForm" (ngSubmit)="submitForm()">
<nz-form-item> <nz-form-item>
<nz-form-label nzSpan="4" nzRequired> <nz-form-label nzSpan="4" nzRequired>
Nom Titre
</nz-form-label> </nz-form-label>
<nz-form-control nzSpan="20" nzErrorTip="Ce champ est requis"> <nz-form-control nzSpan="20" nzErrorTip="Ce champ est requis">
<input nz-input placeholder="Nom" formControlName="name"> <input nz-input placeholder="Titre du livre" formControlName="title">
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label nzSpan="4" nzRequired> <nz-form-label nzSpan="4" nzRequired>
Prénom Date de publication
</nz-form-label> </nz-form-label>
<nz-form-control nzSpan="20" nzErrorTip="Ce champ est requis"> <nz-form-control nzSpan="20" nzErrorTip="Ce champ est requis">
<input nz-input placeholder="Prénom" formControlName="firstname"> <input nz-input type="number" placeholder="2005" formControlName="releaseYear">
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label nzSpan="4" nzRequired>
Auteur
</nz-form-label>
<nz-form-control nzSpan="20" nzErrorTip="Ce champ est requis">
<input nz-input placeholder="Auteur" formControlName="author">
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-flex nzJustify="end"> <nz-flex nzJustify="end">
<!-- <button nz-button nzType="primary" (click)="submitForm()">--> <button nz-button nzType="primary" (click)="submitForm()">
<!-- Valider-->
<!-- </button>-->
<button nz-button nzType="primary" type="submit">
Valider Valider
</button> </button>
</nz-flex> </nz-flex>
</form> </form>
<button nz-button (click)="fillForm()">Simuler une récupération depuis le serveur</button>

View File

@@ -1,10 +1,11 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import {NzFormModule} from "ng-zorro-antd/form"; import {NzFormModule} from "ng-zorro-antd/form";
import {FormControl, FormGroup, Validators} from "@angular/forms"; import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
import {NzFlexDirective} from "ng-zorro-antd/flex";
@Component({ @Component({
selector: 'app-create-book', selector: 'app-create-book',
imports: [NzFormModule], imports: [NzFormModule, ReactiveFormsModule, NzFlexDirective],
templateUrl: './create-book.html', templateUrl: './create-book.html',
styleUrl: './create-book.css', styleUrl: './create-book.css',
}) })

View File

@@ -2,4 +2,6 @@
<h1 class="text-3xl font-bold underline"> <h1 class="text-3xl font-bold underline">
Hello world! Hello world!
</h1> </h1>
<app-create-book></app-create-book>

View File

@@ -1,8 +1,11 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import {CreateBook} from "../../components/create-book/create-book";
@Component({ @Component({
selector: 'app-welcome', selector: 'app-welcome',
imports: [], imports: [
CreateBook
],
templateUrl: './welcome.html', templateUrl: './welcome.html',
styleUrl: './welcome.css' styleUrl: './welcome.css'
}) })