-
Notifications
You must be signed in to change notification settings - Fork 383
Expand file tree
/
Copy pathexercice.component.html
More file actions
214 lines (207 loc) · 10 KB
/
exercice.component.html
File metadata and controls
214 lines (207 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<div class="container-fluid mb-5">
<div class="row mb-5">
<div class="col mt-5">
<div id="exampleForms">
<div class="text-center">
<button class="btn btn-outline-primary font-weight-bold" data-toggle="collapse" data-target="#form1">Form
Control</button>
<button class="btn btn-outline-success font-weight-bold ml-4" data-toggle="collapse"
data-target="#form2">Form
Group</button>
<button class="btn btn-outline-danger font-weight-bold ml-4" data-toggle="collapse" data-target="#form3">Form
Builder</button>
</div>
<div class="accordion-group">
<div class="collapse show" id="form1" data-parent="#exampleForms">
<div class="container-fluid mb-5">
<div class="row mb-5">
<div class="col-4 mt-5">
<div class="card">
<div class="card-body">
<h5 class="card-title text-primary font-weight-bold">Result With formControl
</h5>
<br><span class="font-weight-bold">ExampleForm1 : Value</span><br><br>
name : {{ name.value | json }}<br>
email : {{ email.value | json }}<br>
job : {{ job.value | json }}<br>
comment : {{ comment.value | json }}<br>
</div>
</div>
</div>
<div class="col-8 mt-5">
<div class="card">
<div class="card-body">
<h5 class="card-title text-primary font-weight-bold">Reactive Form with
FormControl</h5>
<div class="form-row">
<div class="form-group col-md-4">
<label for="name">Name</label>
<input type="text" class="form-control" [formControl]="name">
</div>
<div class="form-group col-md-4">
<label for="email">Email</label>
<input type="email" class="form-control" [formControl]="email">
</div>
<div class="form-group col-md-4">
<label for="job">Job</label>
<select class="form-control" [formControl]="job">
<option>Jedi</option>
<option>Sith</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="comment">Comment</label>
<textarea class="form-control" rows="2" [formControl]="comment"></textarea>
</div>
</div>
<div class="form-row justify-content-center">
<button (click)="onSetValueForm1()" type="submit" class="btn btn-primary mr-4">SetValue</button>
<button (click)="onResetForm1()" type="submit" class="btn btn-primary mr-4">Reset</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="collapse" id="form2" data-parent="#exampleForms">
<div class="container-fluid mb-5">
<div class="row mb-5">
<div class="col-4 mt-5">
<div class="card">
<div class="card-body">
<h5 class="card-title text-success font-weight-bold">Result with FormGroup &
FormControl</h5>
<br><span class="font-weight-bold">ExampleForm2 : Value</span><br><br>
<div [innerHTML]="exampleForm2.value | prettyjson"></div>
</div>
</div>
</div>
<div class="col-8 mt-5">
<div class="card">
<div class="card-body">
<h5 class="card-title text-success font-weight-bold">Reactive Form with
FormGroup & FormControl
</h5>
<form [formGroup]="exampleForm2">
<div class="form-row">
<div class="form-group col-md-4">
<label for="name">Name</label>
<input type="text" class="form-control" formControlName="name">
</div>
<div class="form-group col-md-4">
<label for="email">Email</label>
<input type="email" class="form-control" formControlName="email">
</div>
<div class="form-group col-md-4">
<label for="job">Job</label>
<select class="form-control" formControlName="job">
<option>Jedi</option>
<option>Sith</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="comment">Comment</label>
<textarea class="form-control" rows="2" formControlName="comment"></textarea>
</div>
<div class="form-group col-md-6">
<table class="table table-bordered table-sm">
<thead>
<tr>
<th>Friends</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="form-row justify-content-center">
<button (click)="onSetValueForm2()" type="submit"
class="btn btn-success mr-4">SetValue</button>
<button (click)="onPatchValueForm2()" type="submit"
class="btn btn-success mr-4">PatchValue</button>
<button (click)="onResetForm2()" type="submit" class="btn btn-success mr-4">Reset</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="collapse" id="form3" data-parent="#exampleForms">
<div class="container-fluid mb-5">
<div class="row mb-5">
<div class="col-4 mt-5">
<div class="card">
<div class="card-body">
<h5 class="card-title text-danger font-weight-bold">Result with FormBuilder
</h5>
<br><span class="font-weight-bold">ExampleForm3 : Value</span><br><br>
<div [innerHTML]="exampleForm3.value "></div>
</div>
</div>
</div>
<div class="col-8 mt-5">
<div class="card">
<div class="card-body">
<h5 class="card-title text-danger font-weight-bold">Reactive Form with
FormBuilder</h5>
<form [formGroup]="exampleForm3">
<div class="form-row">
<div class="form-group col-md-4">
<label for="name">Name</label>
<input type="text" class="form-control" formControlName="name">
</div>
<div class="form-group col-md-4">
<label for="email">email</label>
<input type="email" class="form-control" formControlName="email">
</div>
<div class="form-group col-md-4">
<label for="job">Job</label>
<select class="form-control" formControlName="job">
<option>Jedi</option>
<option>Sith</option>
</select>
</div>
</div>
<div class="form-row">
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="comment">Comment</label>
<textarea class="form-control" rows="2" formControlName="comment"></textarea>
</div>
<div class="form-group col-md-6">
<table class="table table-bordered table-sm">
<thead>
<tr>
<th scope="col">Friends</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="form-row justify-content-center">
<button (click)="onUpdateForm3()" type="submit" class="btn btn-danger mr-4">Load</button>
<button (click)="onResetForm3()" type="submit" class="btn btn-danger mr-4">Reset</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>