2
2
< div class ="col-lg-5 col-sm-6 ">
3
3
< h2 > Basic Usage</ h2 >
4
4
5
- < h4 > checked </ h4 >
5
+ < h4 > Checked by Default </ h4 >
6
6
< p >
7
7
< ui-switch checked [ariaLabel] ="'checked' "> </ ui-switch >
8
+ </ p >
9
+
10
+ < h4 > Unchecked by Default</ h4 >
11
+ < p >
8
12
< ui-switch [ariaLabel] ="'unchecked' " [checked] ="false "> </ ui-switch >
9
13
</ p >
10
14
11
- < h4 > Disabled</ h4 >
15
+ < h4 > Disabled (checked) </ h4 >
12
16
< p >
13
- < ui-switch disabled > </ ui-switch >
14
17
< ui-switch checked [disabled] ="true "> </ ui-switch >
15
18
</ p >
16
19
17
- < h4 > Change</ h4 >
18
- < ui-switch (change) ="onChange($event) " [ariaLabel] ="'Change' "> </ ui-switch >
19
- < p > change count {{ count }}</ p >
20
- < p > value {{ change }}</ p >
21
-
22
- < h4 > Value Change</ h4 >
23
- < ui-switch (valueChange) ="onValueChange($event) "> </ ui-switch >
24
- < p > value {{ valueChange }}</ p >
20
+ < h4 > Disabled (unchecked)</ h4 >
21
+ < p >
22
+ < ui-switch disabled > </ ui-switch >
23
+ </ p >
25
24
26
- < h4 > Change Event</ h4 >
27
- < ui-switch (changeEvent) ="onChangeEvent($event) "> </ ui-switch >
28
- < p > event {{ changeEvent }}</ p >
25
+ < h4 > reverse</ h4 >
26
+ < p >
27
+ < ui-switch reverse > </ ui-switch >
28
+ </ p >
29
+ </ div >
29
30
31
+ < div class ="col-lg-5 col-sm-6 border-left pl-5 ">
30
32
< h4 > Size</ h4 >
31
33
< p >
32
34
< ui-switch size ="small "> </ ui-switch >
33
35
< ui-switch > </ ui-switch >
34
36
< ui-switch size ="large "> </ ui-switch >
35
37
</ p >
36
38
37
- < h4 > reverse </ h4 >
39
+ < h4 > Color </ h4 >
38
40
< p >
39
- < ui-switch reverse > </ ui-switch >
41
+ < ui-switch > </ ui-switch >
42
+ < ui-switch color ="blue "> </ ui-switch >
43
+ < ui-switch color ="red "> </ ui-switch >
40
44
</ p >
41
45
42
- < h4 > color</ h4 >
43
- < ui-switch > </ ui-switch >
44
- < ui-switch color ="blue "> </ ui-switch >
45
- < ui-switch color ="red "> </ ui-switch >
46
-
47
46
< h4 > switchColor</ h4 >
48
47
< p >
49
48
< ui-switch switchColor ="red "> </ ui-switch >
@@ -59,22 +58,9 @@ <h4>textColor</h4>
59
58
uncheckedLabel ="OFF "
60
59
> </ ui-switch >
61
60
</ p >
62
- </ div >
63
61
64
- < div class ="col-lg-5 col-sm-6 border-left pl-5 ">
65
- < h2 >
66
- < span class ="font-weight-bold "> ngModel</ span >
67
- Usage
68
- </ h2 >
69
- < div class ="row ">
70
- < div class ="col-12 ">
71
- < h4 > two way binding</ h4 >
72
- < ui-switch [(ngModel)] ="enable "> </ ui-switch >
73
- < p > Current Value: {{ enable }}</ p >
74
- </ div >
75
- < app-demo-cdr > </ app-demo-cdr >
76
- </ div >
77
62
< hr />
63
+
78
64
< div class ="row custom-switches ">
79
65
< div class ="col-12 ">
80
66
< h2 > Custom CSS</ h2 >
@@ -84,22 +70,16 @@ <h2>Custom CSS</h2>
84
70
</ p >
85
71
</ div >
86
72
</ div >
73
+
87
74
< hr />
75
+
88
76
< div class ="row ">
89
77
< div class ="col-12 ">
90
78
< h2 > Custom labels</ h2 >
91
79
< p >
92
- < ui-switch
93
- uncheckedLabel ="off "
94
- checkedLabel ="on "
95
- size ="small "
96
- > </ ui-switch >
80
+ < ui-switch uncheckedLabel ="off " checkedLabel ="on " size ="small "> </ ui-switch >
97
81
< ui-switch uncheckedLabel ="off " checkedLabel ="on "> </ ui-switch >
98
- < ui-switch
99
- uncheckedLabel ="off "
100
- checkedLabel ="on "
101
- size ="large "
102
- > </ ui-switch >
82
+ < ui-switch uncheckedLabel ="off " checkedLabel ="on " size ="large "> </ ui-switch >
103
83
</ p >
104
84
105
85
< p >
@@ -108,10 +88,7 @@ <h2>Custom labels</h2>
108
88
uncheckedLabel ="Super Long Label "
109
89
size ="small "
110
90
> </ ui-switch >
111
- < ui-switch
112
- checkedLabel ="Super Long Label "
113
- uncheckedLabel ="Super Long Label "
114
- > </ ui-switch >
91
+ < ui-switch checkedLabel ="Super Long Label " uncheckedLabel ="Super Long Label "> </ ui-switch >
115
92
< ui-switch
116
93
checkedLabel ="Super Long Label "
117
94
uncheckedLabel ="Super Long Label "
@@ -129,7 +106,9 @@ <h2>Custom labels</h2>
129
106
</ p >
130
107
</ div >
131
108
</ div >
109
+
132
110
< hr />
111
+
133
112
< div class ="row ">
134
113
< div class ="col-12 ">
135
114
< h2 > Custom Switch Content</ h2 >
@@ -151,10 +130,10 @@ <h4>Before Change handling + Loading Icon Example</h4>
151
130
< ui-switch
152
131
[loading] ="isLoading "
153
132
[beforeChange] ="fakeAsync "
154
- [(ngModel)] ="enable "
133
+ [(ngModel)] ="beforeChangeValue "
155
134
>
156
- < i class ="fa fa-check " *ngIf ="enable && !isLoading "> </ i >
157
- < i class ="fa fa-times " *ngIf ="!enable && !isLoading "> </ i >
135
+ < i class ="fa fa-check " *ngIf ="beforeChangeValue && !isLoading "> </ i >
136
+ < i class ="fa fa-times " *ngIf ="!beforeChangeValue && !isLoading "> </ i >
158
137
< i class ="fa fa-spinner fa-pulse " *ngIf ="isLoading "> </ i >
159
138
</ ui-switch >
160
139
</ p >
@@ -165,27 +144,73 @@ <h4>Before Change handling + Loading Icon Example</h4>
165
144
166
145
< hr />
167
146
168
- < form class ="form-row " #demoForm ="ngForm " (ngSubmit) ="onSubmit($event) ">
169
- < div class ="col ">
170
- < label for ="feature-name "> Name</ label >
171
- < input type ="text " class ="form-control " id ="feature-name " />
147
+ < div class ="row justify-content-center ">
148
+ < div class ="col-lg-5 col-sm-6 ">
149
+ < h2 > Events</ h2 >
150
+
151
+ < h4 > Change</ h4 >
152
+ < ui-switch (change) ="onChange($event) " [ariaLabel] ="'Change' "> </ ui-switch >
153
+ < p > change count {{ count }}</ p >
154
+ < p > Current Value: {{ change }}</ p >
155
+
156
+ < h4 > Value Change</ h4 >
157
+ < ui-switch (valueChange) ="onValueChange($event) "> </ ui-switch >
158
+ < p > Current Value: {{ valueChange }}</ p >
159
+
160
+ < h4 > Change Event</ h4 >
161
+ < ui-switch (changeEvent) ="onChangeEvent($event) "> </ ui-switch >
162
+ < p > event {{ changeEvent }}</ p >
172
163
</ div >
173
164
174
- < div class ="col ">
175
- < label for ="enable-feature "> Enable Feature</ label >
176
- < ui-switch
177
- class ="custom-control "
178
- id ="enable-feature "
179
- [(ngModel)] ="enableFeature "
180
- name ="enableFeature "
181
- > </ ui-switch >
165
+ < div class ="col-lg-5 col-sm-6 border-left pl-5 ">
166
+ < h2 >
167
+ < span class ="font-weight-bold "> ngModel</ span >
168
+ Usage
169
+ </ h2 >
170
+ < div class ="row ">
171
+ < div class ="col-12 ">
172
+ < h4 > two way binding</ h4 >
173
+ < ui-switch [(ngModel)] ="enable "> </ ui-switch >
174
+ < p > Current Value: {{ enable }}</ p >
175
+ </ div >
176
+ </ div >
177
+
178
+ < h2 > Change Detection < span class ="font-italic "> OnPush</ span > </ h2 >
179
+ < div class ="row ">
180
+ < app-demo-cdr > </ app-demo-cdr >
181
+ </ div >
182
182
</ div >
183
+ </ div >
183
184
185
+ < hr />
186
+
187
+ < div class ="container mt-5 ">
184
188
< div *ngIf ="submitted " class ="col-12 alert alert-info " role ="alert ">
185
- Submitted!
186
- </ div >
189
+ Form Submitted!
187
190
188
- < div class ="col-12 mt-4 ">
189
- < button type ="submit " class ="btn btn-primary "> Submit</ button >
191
+ < pre class ="mt-2 "> < code > {{ submittedValue | json }}</ code > </ pre >
190
192
</ div >
191
- </ form >
193
+
194
+ < form class ="form-row my-3 " #demoForm ="ngForm " (ngSubmit) ="onSubmit($event) ">
195
+ < div class ="col-lg-5 col-sm-6 ">
196
+ < label for ="feature-name "> Name</ label >
197
+ < input type ="text " class ="form-control " id ="feature-name " />
198
+ </ div >
199
+
200
+ < div class ="col-lg-5 col-sm-6 border-left ml-3 pl-3 ">
201
+ < label for ="enable-feature "> Enable Feature</ label >
202
+ < ui-switch
203
+ class ="custom-control "
204
+ id ="enable-feature "
205
+ [(ngModel)] ="enableFeature "
206
+ name ="enableFeature "
207
+ > </ ui-switch >
208
+ </ div >
209
+
210
+ < div class ="col-12 mt-4 ">
211
+ < button type ="submit " class ="btn btn-primary "> Submit</ button >
212
+ </ div >
213
+ </ form >
214
+
215
+ < p > Current Value: {{ enableFeature }}</ p >
216
+ </ div >
0 commit comments