Skip to content
Advertisement

Convert Form Group data to a class in Angular/Typescript

I have a form group that is being passed into the component as input parameter and I need to pass that to a method as an object of the class. Is there a easy way to convert the form group which contains the form control into a class

Class

JavaScript

FormGroup

JavaScript

Component

JavaScript

Service

JavaScript

Can I easily convert the form group to a class? How can I do that?

Advertisement

Answer

Did you try by getting the value from the form ? It will returns an object with the class properties.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement