setvalue form angular code example
Example: set angular FormControl setValue
const objRequest = {
operacion: 'getValuesById',
data: { id: this.id }
};
const response = this.paymentService.myHttp( objRequest );
response.pipe(first()).subscribe(
objResponse => {
this.checkoutForm.get( 'name' ).setValue( objResponse.collection[0].nombre );
this.checkoutForm.get( 'email' ).setValue( objResponse.collection[0].email );
this.checkoutForm.get( 'numAcount' ).setValue( objResponse.collection[0].numAcount );
this.checkoutForm.get( 'bank' ).setValue( objResponse.collection[0].bank_id );
},
error => {
console.log(error);
}
);