I have my form
where I register user data with the first and last name fields and it works perfectly; I also have another form
with the same fields so that I receive the data and it also works. Now, in that same form
I also have a <h4>
tag where I want the data sent ( nombre
) of my first form to appear, but it does not appear. I do not know what I'm missing. I appreciate any help.
I want it to appear here:
<p></p>
<h4></h4>
This is my first registration form: With this code I send my data .. (if it works .. if it sends)
sendUserCliente(id, value) {
this.authService.getById(id).subscribe(res => {
this.userGet = res;
const cliente = new Cliente(value.firstName);
console.log(cliente);
this.router.navigateByUrl('/cliente/carga/detalle-de-carga');
}, err => {
console.error(err);
});
}
this.myForm = this.fb.group({
empresa: [
null,
Validators.compose([Validators.required, Validators.minLength(3), Validators.maxLength(40)])
],
})
First form
<form [formGroup]="myForm" (ngSubmit)="myForm.valid && sendForm(myForm.value)
" novalidate class="form-horizontal">
<div class="form-group has-feedback">
<input
type="text"
id="firstName"
class="form-control"
placeholder="Nombre"
formControlName="firstName"
>
</div>
</form>
Second form
This is my second form where I receive the data of the first form,
but in my h4
I do not see the data registered in the first form.
<form [formGroup]="myForm" (ngSubmit)="myForm.valid && customerUpdateForm(myForm.value)" novalidate class="signup-ademia-formulario-general">
<div class="form-group has-feedback">
<input
type="text"
id="firstName"
class="form-control"
placeholder="Nombre"
formControlName="firstName"
>
</div>
</form>
<h4 id="firstName"></h4>
With this code I receive the data of the first form
customerUpdateForm(value: Object): void {
const user = new User(
this.myForm.value.email,
this.myForm.value.password,
this.myForm.value.firstName, );
this.myForm = this.fb.group({
empresa: [null , Validators.compose([Validators.required, Validators.minLength(3), Validators.maxLength(40)])],
},)
}
This is the code that I use for both and it works for me since I register and I receive the data. Now I want the data of firstName
to appear in the h4
but it does not appear, I do not know what code I should put.