I've got an angular2 component containing a reacitve form containing two addresses: a billing address and a shipment address. I would like to reuse the address part of the form, so I want to create a component containing the address fields (street, zip code, country, ...) which can be reused in other forms.
My problem is, I found no examples how to put parts of a FormGroup into other components. Are there any examples for this?
this.myForm = this._formBuilder.group({
'salutation': [''],
'title': [''],
'firstname': ['', Validators.required],
'lastname': ['', Validators.required],
// address for shipment
'name2': [''],
'street': ['', Validators.required],
'streetnumber': [''],
'zipcode': [''],
'city': ['', Validators.required],
'country': ['', Validators.required],
// address for billing
'billingname2': [''],
'billingstreet': ['', Validators.required],
'billingstreetnumber': [''],
'billingzipcode': [''],
'billingcity': ['', Validators.required],
'billingcountry': ['', Validators.required],
});