1- < form >
1+ < form [formGroup] =" formObj " (ngSubmit) =" onSubmit() " >
22 < h2 > Welcome on board!</ h2 >
33 < p > We just need a little bit of data from you to get you started 🚀</ p >
44
55 < div class ="control ">
66 < label for ="email "> Email</ label >
7- < input id ="email " type ="email " name ="email " />
7+ <!-- [formControl]="formObj.controls.email" we can register 'control' like this also -->
8+ < input id ="email " type ="email " name ="email " formControlName ="email " />
89 </ div >
910
10- < div class ="control-row ">
11+ < div class ="control-row " formGroupName =" passwords " >
1112 < div class ="control ">
1213 < label for ="password "> Password</ label >
13- < input id ="password " type ="password " name ="password " />
14+ <!-- [formControl]="formObj.controls.passwords.controls.password" we can register 'control' like this also -->
15+ < input id ="password " type ="password " name ="password " formControlName ="password " />
1416 </ div >
1517
1618 < div class ="control ">
1719 < label for ="confirm-password "> Confirm Password</ label >
18- < input id ="confirm-password " type ="password " name ="confirm-password " />
20+ < input id ="confirm-password " type ="password " name ="confirm-password " formControlName =" confirmPass " />
1921 </ div >
2022 </ div >
2123
@@ -25,39 +27,39 @@ <h2>Welcome on board!</h2>
2527 < div class ="control-row ">
2628 < div class ="control ">
2729 < label for ="first-name "> First Name</ label >
28- < input type ="text " id ="first-name " name ="first-name " />
30+ < input type ="text " id ="first-name " name ="first-name " formControlName =" firstName " />
2931 </ div >
3032
3133 < div class ="control ">
3234 < label for ="last-name "> Last Name</ label >
33- < input type ="text " id ="last-name " name ="last-name " />
35+ < input type ="text " id ="last-name " name ="last-name " formControlName =" lastName " />
3436 </ div >
3537 </ div >
3638
37- < fieldset >
39+ < fieldset formGroupName =" address " >
3840 < legend > Your Address</ legend >
3941
4042 < div class ="control-row ">
4143 < div class ="control ">
4244 < label for ="street "> Street</ label >
43- < input type ="text " id ="street " name ="street " />
45+ < input type ="text " id ="street " name ="street " formControlName =" street " />
4446 </ div >
4547
4648 < div class ="control ">
4749 < label for ="number "> Number</ label >
48- < input type ="text " id ="number " name ="number " />
50+ < input type ="text " id ="number " name ="number " formControlName =" number " />
4951 </ div >
5052 </ div >
5153
5254 < div class ="control-row ">
5355 < div class ="control ">
5456 < label for ="postal-code "> Postal Code</ label >
55- < input type ="text " id ="postal-code " name ="postal-code " />
57+ < input type ="text " id ="postal-code " name ="postal-code " formControlName =" postal " />
5658 </ div >
5759
5860 < div class ="control ">
5961 < label for ="city "> City</ label >
60- < input type ="text " id ="city " name ="city " />
62+ < input type ="text " id ="city " name ="city " formControlName =" city " />
6163 </ div >
6264 </ div >
6365 </ fieldset >
@@ -68,7 +70,7 @@ <h2>Welcome on board!</h2>
6870 < div class ="control-row ">
6971 < div class ="control ">
7072 < label for ="role "> What best describes your role?</ label >
71- < select id ="role " name ="role ">
73+ < select id ="role " name ="role " formControlName =" role " >
7274 < option value ="student "> Student</ option >
7375 < option value ="teacher "> Teacher</ option >
7476 < option value ="employee "> Employee</ option >
@@ -83,50 +85,50 @@ <h2>Welcome on board!</h2>
8385 < div class ="control-row ">
8486 < label for ="role "> Your Gender </ label >
8587 < div class ="radio ">
86- < input type ="radio " id ="male " name ="genger " value ="male " />
88+ < input type ="radio " id ="male " name ="gender " value ="male " formControlName =" gender " />
8789 < label for ="html "> Male</ label >
8890 </ div >
8991 < div class ="radio ">
90- < input type ="radio " id ="female " name ="genger " value ="female " />
92+ < input type ="radio " id ="female " name ="gender " value ="female " formControlName =" gender " />
9193 < label for ="css "> Female</ label >
9294 </ div >
9395 < div class ="radio ">
94- < input type ="radio " id ="others " name ="genger " value ="others " />
96+ < input type ="radio " id ="others " name ="gender " value ="others " formControlName =" gender " />
9597 < label for ="html "> Not Ready To Tell</ label >
9698 </ div >
9799 </ div >
98100
99101 < br />
100102
101- < fieldset >
103+ < fieldset formArrayName =" source " >
102104 < legend > How did you find us?</ legend >
103105 < div class ="control ">
104- < input type ="checkbox " id ="google " name ="acquisition " value ="google " />
106+ < input type ="checkbox " id ="google " name ="acquisition " value ="google " formControlName =" 0 " />
105107 < label for ="google "> Google</ label >
106108 </ div >
107109
108110 < div class ="control ">
109- < input type ="checkbox " id ="friend " name ="acquisition " value ="friend " />
111+ < input type ="checkbox " id ="friend " name ="acquisition " value ="friend " formControlName =" 1 " />
110112 < label for ="friend "> Referred by friend</ label >
111113 </ div >
112114
113115 < div class ="control ">
114- < input type ="checkbox " id ="other " name ="acquisition " value ="other " />
116+ < input type ="checkbox " id ="other " name ="acquisition " value ="other " formControlName =" 2 " />
115117 < label for ="other "> Other</ label >
116118 </ div >
117119 </ fieldset >
118120
119121 < div class ="control-row ">
120122 < div class ="control ">
121123 < label for ="terms-and-conditions ">
122- < input type ="checkbox " id ="terms-and-conditions " name ="terms " />
124+ < input type ="checkbox " id ="terms-and-conditions " name ="terms " formControlName =" agree " />
123125 I agree to the terms and conditions
124126 </ label >
125127 </ div >
126128 </ div >
127129
128130 < p class ="form-actions ">
129- < button type ="reset " class ="button button-flat "> Reset</ button >
131+ < button type ="reset " class ="button button-flat " (click) =" onReset() " > Reset</ button >
130132 < button type ="submit " class ="button "> Sign up</ button >
131133 </ p >
132134</ form >
0 commit comments