PepeW
PepeW

Reputation: 607

Custom component FormControl pass value to parent component

I have a custom form control component implementing controlValueAccessor and working fine when used directly in a formGroup.

But now I'm trying to use my custom form control component in a "wrapper" component and using this wrapper component instead in my form.

I'm really struggling to do so, do I need to implement again a controlValueAccessor on my wrapper component ? I just want my wrapper component to pass the value to the form.

Here's a stackblitz: https://stackblitz.com/edit/angular-8kllvf

Upvotes: 1

Views: 1741

Answers (1)

IAfanasov
IAfanasov

Reputation: 4993

Implementing controlValueAccessor would be an option. Passing FormControl as an input an alternative: https://stackblitz.com/edit/angular-8kllvf-lw1pwn?file=src/app/profile-editor/profile-editor.component.html

Upvotes: 1

Related Questions