23
23
* on the element causing it to become hidden. When true, the ng-hide CSS class is removed
24
24
* from the element causing the element not to appear hidden.
25
25
*
26
+ * <div class="alert alert-warning">
27
+ * **Note:** Here is a list of values that ngShow will consider as a falsy value (case insensitive):<br />
28
+ * "f" / "0" / "false" / "no" / "n" / "[]"
29
+ * </div>
30
+ *
26
31
* ## Why is !important used?
27
32
*
28
33
* You may be wondering why !important is used for the .ng-hide CSS class. This is because the `.ng-hide` selector
36
41
*
37
42
* ### Overriding .ng-hide
38
43
*
39
- * If you wish to change the hide behavior with ngShow/ngHide then this can be achieved by
40
- * restating the styles for the .ng-hide class in CSS:
44
+ * By default, the `.ng-hide` class will style the element with `display:none!important`. If you wish to change
45
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
46
+ * class in CSS:
47
+ *
41
48
* ```css
42
49
* .ng-hide {
43
50
* /* this is just another form of hiding an element */
51
+ * display:block!important;
44
52
* position:absolute;
45
53
* top:-9999px;
46
54
* left:-9999px;
47
55
* }
48
56
* ```
49
57
*
50
- * Just remember to include the important flag so the CSS override will function.
51
- *
52
- * <div class="alert alert-warning">
53
- * **Note:** Here is a list of values that ngShow will consider as a falsy value (case insensitive):<br />
54
- * "f" / "0" / "false" / "no" / "n" / "[]"
55
- * </div>
58
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
56
59
*
57
60
* ## A note about animations with ngShow
58
61
*
83
86
* .my-element.ng-hide-remove.ng-hide-remove-active { ... }
84
87
* ```
85
88
*
89
+ * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display
90
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
91
+ *
86
92
* @animations
87
93
* addClass: .ng-hide - happens after the ngShow expression evaluates to a truthy value and the just before contents are set to visible
88
94
* removeClass: .ng-hide - happens after the ngShow expression evaluates to a non truthy value and just before the contents are set to hidden
@@ -186,6 +192,11 @@ var ngShowDirective = ['$animate', function($animate) {
186
192
* on the element causing it to become hidden. When false, the ng-hide CSS class is removed
187
193
* from the element causing the element not to appear hidden.
188
194
*
195
+ * <div class="alert alert-warning">
196
+ * **Note:** Here is a list of values that ngHide will consider as a falsy value (case insensitive):<br />
197
+ * "f" / "0" / "false" / "no" / "n" / "[]"
198
+ * </div>
199
+ *
189
200
* ## Why is !important used?
190
201
*
191
202
* You may be wondering why !important is used for the .ng-hide CSS class. This is because the `.ng-hide` selector
@@ -199,30 +210,27 @@ var ngShowDirective = ['$animate', function($animate) {
199
210
*
200
211
* ### Overriding .ng-hide
201
212
*
202
- * If you wish to change the hide behavior with ngShow/ngHide then this can be achieved by
203
- * restating the styles for the .ng-hide class in CSS:
213
+ * By default, the `.ng-hide` class will style the element with `display:none!important`. If you wish to change
214
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
215
+ * class in CSS:
216
+ *
204
217
* ```css
205
218
* .ng-hide {
206
- * //this is just another form of hiding an element
219
+ * /* this is just another form of hiding an element */
220
+ * display:block!important;
207
221
* position:absolute;
208
222
* top:-9999px;
209
223
* left:-9999px;
210
224
* }
211
225
* ```
212
226
*
213
- * Just remember to include the important flag so the CSS override will function.
214
- *
215
- * <div class="alert alert-warning">
216
- * **Note:** Here is a list of values that ngHide will consider as a falsy value (case insensitive):<br />
217
- * "f" / "0" / "false" / "no" / "n" / "[]"
218
- * </div>
227
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
219
228
*
220
229
* ## A note about animations with ngHide
221
230
*
222
231
* Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
223
- * is true and false. This system works like the animation system present with ngClass, except that
224
- * you must also include the !important flag to override the display property so
225
- * that you can perform an animation when the element is hidden during the time of the animation.
232
+ * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`
233
+ * CSS class is added and removed for you instead of your own CSS class.
226
234
*
227
235
* ```css
228
236
* //
@@ -238,6 +246,9 @@ var ngShowDirective = ['$animate', function($animate) {
238
246
* .my-element.ng-hide-remove.ng-hide-remove-active { ... }
239
247
* ```
240
248
*
249
+ * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display
250
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
251
+ *
241
252
* @animations
242
253
* removeClass: .ng-hide - happens after the ngHide expression evaluates to a truthy value and just before the contents are set to hidden
243
254
* addClass: .ng-hide - happens after the ngHide expression evaluates to a non truthy value and just before the contents are set to visible
0 commit comments