Book Image

AngularJS Web Application Development Blueprints

By : Vinci J Rufus
Book Image

AngularJS Web Application Development Blueprints

By: Vinci J Rufus

Overview of this book

Table of Contents (17 chapters)
AngularJS Web Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding page transitions using ngAnimate


Right now, the pages change abruptly when swiped upon; we would ideally like pages to slide in, to give it a more pleasant feel.

We will make use of the ngAnimate module to achieve our page transitions; it has been completely rewritten for Angular 1.2.x branches. It provides CSS3 transition and keyframe animation support for various AngularJS directives and controls.

Currently, the following directives support animations for enter and exit events:

  • ngView

  • ngRepeat

  • ngInclude

  • ngIf

  • ngSwitch

  • ngClass

  • ngShow

  • ngHide

The way ngAnimate works is it simply adds ng-enter and ng-leave CSS classes to the directive.

We are then required to write our own CSS3 transition effects for these classes. Let's see how to go about doing this.

Loading the ngAnimate module

Like ngTouch, even ngAnimate doesn't come by default with AngularJS, and it needs to be installed and included separately. First, run the following command in the terminal:

bower install angular-animate -...