I'm using the ngAnimate module, but all my ng-if
, ng-show
, etc, are affected by that, I want to leverage ngAnimate for some selected elements.
For performance and some bugs in elements that shows and hide very speedy.
thanks.
I'm using the ngAnimate module, but all my ng-if
, ng-show
, etc, are affected by that, I want to leverage ngAnimate for some selected elements.
For performance and some bugs in elements that shows and hide very speedy.
thanks.
There are two ways you can disbale animations in AngularJS if you have the module ngAnimate as a dependency on your module:
Disable or enable the animation globally on the $animate service:
Disable the animations for a specific element - this must be the element for that angular will add the animationstate css classes (e.g. ng-enter, ...)!
As of Angular 1.4 version you should reverse the arguments:
Documentation for
$animate
.thanks, i wrote a directive which you can place on the element
CoffeeScript:
JavaScript:
I do NOT want to use ngAnimate on my
ng-if
's, so this would be my solution:Just posting this as another suggestion!
I know that it is a delayed reply, but here we use in MainController:
But the problem is that when we disable all animations, the ui-select are configured to
opacity: 0
.So, its necessary to set opacity to 1 using CSS:
This will properly set opacity and the ui-select will work.
Just add this to your CSS. It is best if it is the last rule:
then add
no-animate
to the class of element you want to disable. Example:To disable ng-animate for certain elements, using a CSS class, which follows Angular animate paradigm, you can configure ng-animate to test the class using regex.
Config
Usage
Simply add the
ng-animate-disabled
class to any elements you want to be ignored by ng-animate.Credit http://davidchin.me/blog/disable-nganimate-for-selected-elements/