According to the Reactive Forms documentation, I can refactor my FormGroup definitions from
this.heroForm = this.fb.group({
name: ['', Validators.required ],
address: this.fb.group({
street: '',
city: '',
state: '',
zip: ''
})
});
to
export class Address {
street = '';
city = '';
state = '';
zip = '';
}
this.heroForm = this.fb.group({
name: ['', Validators.required ],
address: this.fb.group(new Address())
});
If I create a form group from a data model, how do I add validators?