43 lines
879 B
TypeScript
43 lines
879 B
TypeScript
import { Contact } from '@nested-forms/contact-model';
|
|
import { Component } from '@angular/core';
|
|
import { FormGroup, FormBuilder } from '@angular/forms';
|
|
|
|
@Component({
|
|
selector: 'nested-forms-root',
|
|
templateUrl: './app.component.html',
|
|
styleUrls: ['./app.component.css']
|
|
})
|
|
export class AppComponent {
|
|
title = 'parent-form';
|
|
|
|
contact: Contact = {
|
|
name: {
|
|
firstName: 'John',
|
|
lastName: 'Public',
|
|
middleName: 'Q',
|
|
prefix: 'Mr',
|
|
suffix: 'III',
|
|
},
|
|
addresses: [
|
|
{
|
|
line_1: '123 Main Street',
|
|
city: 'New York',
|
|
state: 'NY',
|
|
postalCode: '12345',
|
|
},
|
|
{
|
|
line_1: '123 South Street',
|
|
city: 'Boston',
|
|
state: 'MA',
|
|
postalCode: '54321',
|
|
},
|
|
],
|
|
};
|
|
|
|
form: FormGroup;
|
|
|
|
constructor(private fb: FormBuilder) {
|
|
this.form = this.fb.group({});
|
|
}
|
|
}
|