I want to show either element A or B based on the value of a boolean, but when the value switches, both elements are shown briefly, using ng-if:
<div ng-if="a"></div>
<div ng-if="!a"></div>
This also happens when I use ng-show/ng-hide:
<div ng-show="a"></div>
<div ng-hide="a"></div>
And even ng-switch:
<div ng-switch="a || 'false'">
<div ng-switch-default></div>
<div ng-switch-when="false"></div>
</div>
Is there any way to enforce only one of those elements being shown at the same time, or it this just not possible?
(Late answer for late people like me.)
I'm guessing the project uses ngAnimate
that causes these kinds of issues.
This question has several answers, ranging from removing ngAnimate
, changing related CSS and switching to using ngClass
.
Another question has an answer suggesting to configure animations with $animateProvider
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With