24 lines
796 B
TypeScript
24 lines
796 B
TypeScript
import { FormGroup, FormBuilder } from '@angular/forms';
|
|
import { Component } from '@angular/core';
|
|
|
|
@Component({
|
|
selector: 'nested-forms-root',
|
|
templateUrl: './app.component.html',
|
|
styleUrls: ['./app.component.css']
|
|
})
|
|
export class AppComponent {
|
|
form: FormGroup;
|
|
|
|
constructor(private fb: FormBuilder) {
|
|
this.form = this.fb.group({
|
|
nameGroup: this.fb.group({
|
|
firstName: [], // new FormControl(this.name ? this.name.firstName : ''),
|
|
lastName: [], // new FormControl(this.name ? this.name.lastName : ''),
|
|
middleName: [], // new FormControl(this.name ? this.name.middleName : ''),
|
|
prefix: [], // new FormControl(this.name ? this.name.prefix : ''),
|
|
suffix: [], // new FormControl(this.name ? this.name.suffix : ''),
|
|
})
|
|
});
|
|
}
|
|
}
|