added profil section and fix error in stock-table.html
This commit is contained in:
42
src/app/components/profil-form/profil-form.ts
Normal file
42
src/app/components/profil-form/profil-form.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||
|
||||
@Component({
|
||||
selector: 'app-profil-form',
|
||||
imports: [
|
||||
FormsModule,
|
||||
NzColDirective,
|
||||
NzFlexDirective,
|
||||
NzFormControlComponent,
|
||||
NzFormDirective,
|
||||
NzFormItemComponent,
|
||||
NzFormLabelComponent,
|
||||
NzInputDirective,
|
||||
ReactiveFormsModule
|
||||
],
|
||||
templateUrl: './profil-form.html',
|
||||
styleUrl: './profil-form.css',
|
||||
})
|
||||
export class ProfilForm {
|
||||
profilForm: FormGroup = new FormGroup({
|
||||
newName: new FormControl<string>(null, [Validators.required]),
|
||||
newEmail: new FormControl<string>(null, [Validators.required]),
|
||||
newFonction: new FormControl<string>(null, [Validators.required]),
|
||||
newPassword: new FormControl<string>(null, [Validators.required])
|
||||
})
|
||||
|
||||
submitForm() {
|
||||
// Pour annuler si le formulaire est invalide
|
||||
if (this.profilForm.invalid) return;
|
||||
|
||||
// Pour obtenir la valeur du formulaire
|
||||
console.log(this.profilForm.getRawValue())
|
||||
|
||||
// Pour vider le formulaire
|
||||
this.profilForm.reset()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user