Check out a free preview of the full Building Awesomer Apps with Angular course:
The "Course Q&A: Form Nesting" Lesson is part of the full, Building Awesomer Apps with Angular course featured in this preview video. Here's what you'd learn in this lesson:

Lukas takes a question from a student about nesting form groups.

Get Unlimited Access Now

Transcript from the "Course Q&A: Form Nesting" Lesson

[00:00:00]
>> Speaker 1: If you have a nest of multiple form groups, can you do that? You have form controls and then you have form group and then you have parent FormGroups. So when do you that do you nest in DIVs, like you put in DIVs onto input containers?
>> Lukas Ruebbelke: So your HTML structure is not bound So ideally your form would model your form group and everything inside of it.

[00:00:31] But, you could lay it out however you want.
>> Speaker 1: But do work or do you have to put the FormGroup? On every element inside it. So if I want to give like say there was username and password, right? And I have wanted a FormGroup, different form groups for username and different FormGroup for password, okay?

[00:00:50] And the tool FormGroup as login, okay? So I have one FormGroup called as login and then I have second FormGroup called as username. And in username I have first name and last name. And password I have in the password.
>> Lukas Ruebbelke: I would probably grab, if I have a group, let's say I have, let's think of it this way.

[00:01:08] You have user name, password, and you might have another FormGroup with like an address. It's a logical division of the model. The I would probably, one, put them in two separate FormGroups. Which then live in the top level FormGroup, and I would probably wrap those in a DIV.

[00:01:28] So each FormGroup would get a DIV and I would do form group name and put that in there.
>> Speaker 1: Okay, and so there's only one form on the page, as such.
>> Lukas Ruebbelke: Yes.
>> Speaker 1: Okay.