</>
Skip to content
AngularJS lessons (23/28)

AngularJS — Animations

Setup Animations

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular-animate.min.js"></script>
var app = angular.module('myApp', ['ngAnimate']);

CSS Classes

ClassWhen Added
ng-enterElement enters DOM
ng-leaveElement leaves DOM
ng-moveElement moves in DOM
ng-hideElement hidden
ng-showElement shown

CSS Animations

.ng-enter {
  opacity: 0;
  transition: opacity 0.5s;
}

.ng-enter-active {
  opacity: 1;
}

.ng-leave {
  opacity: 1;
  transition: opacity 0.5s;
}

.ng-leave-active {
  opacity: 0;
}

Show/Hide Animations

div {
  transition: all 0.5s ease;
}

div.ng-hide {
  opacity: 0;
  transform: scale(0.8);
}

Repeat Animations

li.ng-enter {
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s;
}

li.ng-enter-active {
  opacity: 1;
  transform: translateY(0);
}

Mini Practice

  1. Enable ngAnimate
  2. Create enter/leave animations
  3. Animate show/hide
  4. Add transition effects

Up Next

Continue with DOM — AngularJS DOM manipulation.

Related Topics

Frequently Asked Questions about Animations

What is Animations in AngularJS?

Animations is a fundamental concept in AngularJS. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Animations?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Animations.

Why is Animations important in AngularJS?

Animations is essential for AngularJS development. Understanding this concept will help you write better code and solve real-world problems more effectively.