What is the difference between $ animate and ngAnimate?

Posted on

Question :

In Angular 1, we have a Service named $animate . This already comes by default in the Angular.

But we also have a library, which is added optionally in the project, called ngAnimate . This is intended to add animations in ng-if , ng-repeat , ng-show and the like.

I would like to know what is the difference between the two?

Does this% with% exclude the use of $animate ?


Answer :

These two providers are different ways of dealing with the same module, module.animation() .

ngAnimate is a directive that is injected into directives (such as ngRepeat , ngView , ngIf , and others) that can benefit from the animation module to display state differences .

$animate is a service that allows you to programmatically handle the animation module, triggering events of classes ( $animate.addClass() , .removeClass() , .enter() , .leave() , and others ).


Leave a Reply

Your email address will not be published. Required fields are marked *