Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 707d21f

Browse files
committed
docs(ngShow/ngHide): add note about flicker when toggling elements
Related to #14015
1 parent 64c23e4 commit 707d21f

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/ng/directive/ngShowHide.js

+34
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,23 @@ var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
182182
});
183183
</file>
184184
</example>
185+
*
186+
* @knownIssue
187+
*
188+
* ### Flickering when using ngShow to toggle between elements
189+
*
190+
* When using {@link ngShow} and / or {@link ngHide} to toggle between elements , it can
191+
* happen that both the element to show and the element to hide are visible at the same time.
192+
*
193+
* This usually happens when the {@link ngAnimate ngAnimate module} is included, but no actual animations
194+
* are defined for {@link ngShow} / {@link ngHide}.
195+
*
196+
* There are several way to mitigate this problem:
197+
*
198+
* - {@link guide/animations#how-to-selectively-enable-disable-and-skip-animations Disable animations on the affected elements}.
199+
* - Use {@link ngIf} instead of {@link ngShow} / {@link ngHide}.
200+
* - Use the special CSS selector `ng-hide.ng-hide-animate` to set `{display: none}` or similar on the affected elements .
201+
* - Define an animation on the affected elements.
185202
*/
186203
var ngShowDirective = ['$animate', function($animate) {
187204
return {
@@ -382,6 +399,23 @@ var ngShowDirective = ['$animate', function($animate) {
382399
});
383400
</file>
384401
</example>
402+
*
403+
* @knownIssue
404+
*
405+
* ### Flickering when using ngHide to toggle between elements
406+
*
407+
* When using {@link ngShow} and / or {@link ngHide} to toggle between elements , it can
408+
* happen that both the element to show and the element to hide are visible at the same time.
409+
*
410+
* This usually happens when the {@link ngAnimate ngAnimate module} is included, but no actual animations
411+
* are defined for {@link ngShow} / {@link ngHide}.
412+
*
413+
* There are several way to mitigate this problem:
414+
*
415+
* - {@link guide/animations#how-to-selectively-enable-disable-and-skip-animations Disable animations on the affected elements}.
416+
* - Use {@link ngIf} instead of {@link ngShow} / {@link ngHide}.
417+
* - Use the special CSS selector `ng-hide.ng-hide-animate` to set `{display: none}` or similar on the affected elements .
418+
* - Define an animation on the affected elements.
385419
*/
386420
var ngHideDirective = ['$animate', function($animate) {
387421
return {

0 commit comments

Comments
 (0)