Search code examples
angularjsng-animate

Angularjs animation restrict for class


Good day. I have a question: is there any way to restrict to angular adding additional classes for element for animation?

i.e.: when element has some transition in CSS, and i try to add another class with ng-class, it also adds: class-add, class-add-active.

I don't want angular to add this classes.


Solution

  • Yes there's a way to do it, you need to add a filter on class names you want to animate via a regex

    angular.module('myApp', ['ngAnimate']).config(['$animateProvider', function($animateProvider){     
      $animateProvider.classNameFilter(/myClass/);
    }]);
    
    <div class="myClass"> ... </div>