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