I have tried mapping reactive form properties to an object class using (Object.Assign) but it adds extra properties that doesn’t belong to the class or interface, ex:
export interface MyInterface {
a: string |null,
b: number|null
}
and when I submit the form I do the following:
onSubmit() {
const mynewobject:MyInterface = Object.assign({},this.myForm.getRawValue());
console.warn(mynewobject);
}
but the result I receive is :
{a: 'text', b: 1, c: 'additional property from form'}
I only want to map properties a and b.
Is there a way to map only properties that belong to the class or interface?