fixed errors

This commit is contained in:
2025-11-24 10:32:11 +01:00
parent aa96fa25ca
commit c7e962038b
4 changed files with 8 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
<form nz-form nzLayout="horizontal" [formGroup]="createAuthorForm" (ngSubmit)="submitForm()">
<form nz-form nzLayout="horizontal" [formGroup]="createAuthorForm">
<nz-form-item>
<nz-form-label nzSpan="8" nzRequired>
Nom

View File

@@ -2,6 +2,7 @@ import {Component, input} from '@angular/core';
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid";
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
import {NzInputDirective} from "ng-zorro-antd/input";
@Component({
selector: 'app-create-author',
@@ -13,7 +14,8 @@ import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabe
NzFormItemComponent,
NzFormLabelComponent,
NzRowDirective,
ReactiveFormsModule
ReactiveFormsModule,
NzInputDirective
],
templateUrl: './create-author.html',
styleUrl: './create-author.css',
@@ -23,15 +25,4 @@ export class CreateAuthor {
name: new FormControl<string>(null, [Validators.required]),
firstName: new FormControl<string>(null, [Validators.required])
})
submitForm() {
// Pour annuler si le formulaire est invalide
if (this.createAuthorForm.invalid) return;
// Pour obtenir la valeur du formulaire
console.log(this.createAuthorForm.getRawValue())
// Pour vider le formulaire
this.createAuthorForm.reset()
}
}

View File

@@ -3,6 +3,7 @@ import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} fr
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid";
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
import {GetAuthorDto, GetLoanDto} from "../../services/api";
import {NzInputDirective} from "ng-zorro-antd/input";
@Component({
selector: 'app-update-author',
@@ -14,7 +15,8 @@ import {GetAuthorDto, GetLoanDto} from "../../services/api";
NzFormItemComponent,
NzFormLabelComponent,
NzRowDirective,
ReactiveFormsModule
ReactiveFormsModule,
NzInputDirective
],
templateUrl: './update-author.html',
styleUrl: './update-author.css',

View File

@@ -49,7 +49,7 @@ export class Author{
this.notificationService.success(
'Success',
'Utilisateur ce'
'Auteur enregistré'
)
} catch (e) {
this.notificationService.error(