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

If you are a web application developer interested in using AngularJS for a real-life project, then this book is for you. As a prerequisite, knowledge of JavaScript and HTML is expected, and a working knowledge of AngularJS is preferred.
Table of Contents (12 chapters)
11
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 -...