use services i angular 10 to share forms code example
Example: angular create a service
>>> ng generate service service_name
or
>>> ng generate service /folder-name/service-name
>>> ng generate service service_name
or
>>> ng generate service /folder-name/service-name