added edit fonction
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {Component, effect, input} 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";
|
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select";
|
||||
import {GetUserDto} from "../../services/api";
|
||||
|
||||
@Component({
|
||||
selector: 'app-profil-form',
|
||||
@@ -31,4 +32,18 @@ export class ProfilForm {
|
||||
fonction: new FormControl<string>(null, [Validators.required]),
|
||||
password: new FormControl<string>(null, [Validators.required])
|
||||
})
|
||||
|
||||
user = input<GetUserDto | null>(null);
|
||||
constructor() {
|
||||
effect(() => {
|
||||
if (this.user()) {
|
||||
this.profilForm.patchValue({
|
||||
name: this.user().name,
|
||||
email: this.user().email,
|
||||
fonction: this.user().fonction,
|
||||
password: this.user().password
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user