How can I do this using only three lines instead of same three lines in 3 if statements?
CodePudding user response:
(Please, don't paste code as link to images: we can't search it, we can't copy-paste it, etc).
I guess you could patchValue() using computed property values (and hope that you never make a typo, because now TypeScript compiler won't catch them), but may I suggest rethinking the form and making custodian
, requester
and technical
separate form groups, each with its phone
, name
and department
properties?
CodePudding user response:
You could do something like I did in the updateValues
method: https://stackblitz.com/edit/angular-ivy-xkjmav?file=src/app/app.component.ts