I have a component with form for creating and updating the user. I get information about user to update through the input parameter @Input('user') user. Also I wanna use this parameter to dynamicly paste a data about selected user to the reactive form. I created form like this one:
@Input('user') user = new User();
form: FormGroup = this.fb.group({
id: [{ value: this.user.id, disabled: true }],
login: [this.user.login],
password: [{ value: '', disabled: true }, [Validators.required, Validators.minLength(5), Validators.maxLength(100)]],
userName: [this.user.userName, [Validators.required, Validators.minLength(2), Validators.maxLength(100)]],
email: [this.user.email, [Validators.email]],
lastLoginDate: [this.user.lastLoginDate],
loginAttempts: [this.user.loginAttempts],
passwordChangeDate: [this.user.passwordChangeDate],
passwordChangeRequired: [this.user.passwordChangeRequired],
roles: this.fb.array([this.user.roles]),
isActive: [this.user.isActive]
});
I expected the form control values have to change dynamicly when the user is updated. But despite user is updated, values at form are still the same.