1
1
< div class ="container ">
2
- < form novalidate >
2
+ < form #form =" ngForm " (ngSubmit) =" signUp(form.value) " novalidate >
3
3
< div class ="card card-signup ">
4
4
< div class ="card-header "> Profile</ div >
5
5
< div class ="card-block ">
6
6
< div class ="form-group row ">
7
7
< label for ="inputEmail " class ="col-sm-3 col-form-label "> Email*</ label >
8
8
< div class ="col-sm-9 ">
9
9
< input type ="
email "
class ="
form-control "
id ="
inputEmail3 "
placeholder ="
[email protected] "
10
- name ="email " required minlength ="5 ">
10
+ ngModel labsEmailValidator name ="email " required minlength ="5 ">
11
11
</ div >
12
12
</ div >
13
13
< div class ="form-group row ">
14
14
< label for ="inputFirstName " class ="col-sm-3 col-form-label "> First Name*</ label >
15
15
< div class ="col-sm-9 ">
16
16
< input type ="text " class ="form-control " id ="inputFirstName " placeholder =""
17
- name ="firstName " required maxlength ="25 ">
17
+ ngModel pattern =" [A-Za-z .]* " name ="firstName " required maxlength ="25 ">
18
18
</ div >
19
19
</ div >
20
20
< div class ="form-group row ">
21
21
< label for ="inputLastName " class ="col-sm-3 col-form-label "> Last Name</ label >
22
22
< div class ="col-sm-9 ">
23
23
< input type ="text " class ="form-control " id ="inputLastName " placeholder =""
24
- name ="lastName " maxlength ="25 ">
24
+ ngModel name ="lastName " maxlength ="25 ">
25
25
</ div >
26
26
</ div >
27
27
< fieldset class ="form-group row ">
28
28
< legend class ="col-form-legend col-sm-3 "> Gender</ legend >
29
29
< div class ="col-sm-9 form-radio ">
30
30
< label class ="custom-control custom-radio ">
31
- < input id ="inputMale " name ="gender " type ="radio " class ="custom-control-input ">
31
+ < input id ="inputMale " ngModel value =" Male " name ="gender " type ="radio " class ="custom-control-input ">
32
32
< span class ="custom-control-indicator "> </ span >
33
33
< span class ="custom-control-description "> Male</ span >
34
34
</ label >
35
35
< label class ="custom-control custom-radio ">
36
- < input id ="inputFemale " name ="gender " type ="radio " class ="custom-control-input ">
36
+ < input id ="inputFemale " ngModel name ="gender " value =" Female " type ="radio " class ="custom-control-input ">
37
37
< span class ="custom-control-indicator "> </ span >
38
38
< span class ="custom-control-description "> Female</ span >
39
39
</ label >
42
42
< div class ="form-group row ">
43
43
< div class ="offset-sm-3 col-sm-9 ">
44
44
< label class ="custom-control custom-checkbox ">
45
- < input type ="checkbox " name ="notrobot " class ="custom-control-input " required >
45
+ < input type ="checkbox " ngModel name ="notrobot "
46
+ class ="custom-control-input " required labsCheckboxCheckedValidator >
46
47
< span class ="custom-control-indicator "> </ span >
47
48
< span class ="custom-control-description "> I am not a Robot*</ span >
48
49
</ label >
52
53
</ div >
53
54
< div class ="card card-signup ">
54
55
< div class ="card-header "> Address</ div >
55
- < div class ="card-block ">
56
+ < div class ="card-block " ngModelGroup =" address " >
56
57
< div class ="form-group row ">
57
58
< label for ="inputAddressLine1 " class ="col-sm-3 col-form-label "> Address Line 1*</ label >
58
59
< div class ="col-sm-9 ">
59
60
< input type ="text " class ="form-control " id ="inputAddressLine1 " placeholder ="Room/Flat/Plot No. Locality "
60
- name ="addressLine1 " required >
61
+ ngModel name ="addressLine1 " required >
61
62
</ div >
62
63
</ div >
63
64
< div class ="form-group row ">
64
65
< label for ="inputAddressLine2 " class ="col-sm-3 col-form-label "> Address Line 2</ label >
65
66
< div class ="col-sm-9 ">
66
67
< input type ="text " class ="form-control " id ="inputAddressLine2 " placeholder ="Street, Area "
67
- name ="addressLine2 ">
68
+ ngModel name ="addressLine2 ">
68
69
</ div >
69
70
</ div >
70
71
< div class ="row ">
71
72
< div class ="form-group ">
72
73
< label for ="inputCity " class ="col-sm-3 col-form-label "> City*</ label >
73
74
< div class ="col-sm-4 ">
74
75
< input type ="text " class ="form-control " id ="inputCity " placeholder ="City "
75
- name ="city " required >
76
+ ngModel name ="city " required >
76
77
</ div >
77
78
</ div >
78
79
< div class ="form-group ">
79
80
< label for ="inputZipCode " class ="col-sm-1 col-form-label "> Zip*</ label >
80
81
< div class ="col-sm-4 ">
81
82
< input type ="number " class ="form-control " id ="inputZipCode " placeholder ="Zip code "
82
- name ="zipCode " required >
83
+ ngModel name ="zipCode " required >
83
84
</ div >
84
85
</ div >
85
86
</ div >
86
87
< div class ="form-group row " style ="margin-top:1.2rem ">
87
88
< label for ="inputLandmark " class ="col-sm-3 col-form-label "> Landmark</ label >
88
89
< div class ="col-sm-9 ">
89
90
< input type ="text " class ="form-control " id ="inputLandmark " placeholder ="Landmark "
90
- name ="landmark " >
91
+ ngModel name ="landmark " >
91
92
</ div >
92
93
</ div >
93
94
< fieldset class ="form-group row ">
94
95
< legend class ="col-form-legend col-sm-3 "> Type</ legend >
95
96
< div class ="col-sm-9 form-radio ">
96
97
< label class ="custom-control custom-radio ">
97
- < input id ="inputResidence " name ="addressType " type ="radio " class ="custom-control-input ">
98
+ < input id ="inputResidence " ngModel name ="addressType " value =" Residence " type ="radio " class ="custom-control-input ">
98
99
< span class ="custom-control-indicator "> </ span >
99
100
< span class ="custom-control-description "> Residence</ span >
100
101
</ label >
101
102
< label class ="custom-control custom-radio ">
102
- < input id ="inputOffice " name ="addressType " type ="radio " class ="custom-control-input ">
103
+ < input id ="inputOffice " ngModel name ="addressType " value =" Office " type ="radio " class ="custom-control-input ">
103
104
< span class ="custom-control-indicator "> </ span >
104
105
< span class ="custom-control-description "> Office</ span >
105
106
</ label >
109
110
< div class ="form-group ">
110
111
< label for ="inputCountry " class ="col-sm-3 col-form-label "> Country</ label >
111
112
< div class ="col-sm-6 ">
112
- < select class ="custom-select " id ="inputCountry " name ="country ">
113
+ < select class ="custom-select " id ="inputCountry " name ="country " ngModel >
113
114
< option value ="" selected > Select Country</ option >
114
115
< option value ="ALA "> Åland Islands</ option >
115
116
< option value ="ALB "> Albania</ option >
365
366
</ div >
366
367
</ div >
367
368
</ div >
368
- < div class ="form-group row ">
369
+ < div class ="row ">
369
370
< div class ="offset-sm-2 col-sm-9 ">
370
- < button type ="submit " class ="btn btn-primary "> Sign up</ button >
371
+ < button type ="submit " class ="btn btn-primary " [disabled] ="!form.valid "> Sign up</ button >
372
+ Your form is {{form.valid ? 'valid' : 'invalid'}}
371
373
</ div >
372
374
</ div >
373
375
</ form >
374
376
</ div >
377
+
378
+
379
+ < div class ="jumbotron "> {{form.value | json}}</ div >
0 commit comments