Book Image

AngularJS Web application development Cookbook

By : Matthew Frisbie
Book Image

AngularJS Web application development Cookbook

By: Matthew Frisbie

Overview of this book

Packed with easy-to-follow recipes, this practical guide will show you how to unleash the full might of the AngularJS framework. Skip straight to practical solutions and quick, functional answers to your problems without hand-holding or slogging through the basics. Avoid antipatterns and pitfalls, and squeeze the maximum amount out of the most powerful parts of the framework, from creating promise-driven applications to building an extensible event bus. Throughout, take advantage of a clear problem-solving approach that offers code samples and explanations of components you should be using in your production applications.
Table of Contents (17 chapters)
AngularJS Web Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Staggering batched animations


AngularJS incorporates native support for staggering animations that happen as a batch. This will almost exclusively occur in the context of ng-repeat.

Getting ready

Suppose that you have an animated ng-repeat implementation, as follows:

(style.css)

.container {
  line-height: 30px;
}
.container.ng-enter,
.container.ng-leave,
.container.ng-move {
  transition: all linear 0.2s;
  
}
.container.ng-enter,
.container.ng-leave.ng-leave-active,
.container.ng-move {
  opacity: 0;
  max-height: 0;
}
.container.ng-enter.ng-enter-active,
.container.ng-leave,
.container.ng-move.ng-move-active {
  opacity: 1;
  max-height: 30px;
}

(index.html)

<div ng-app="myApp">
  <div ng-controller="Ctrl">
    <input ng-model="search" />
    <div ng-repeat="name in names | filter:search"
         class="container">
      {{ name }}
    </div>
  </div>
</div>

(app.js)

angular.module('myApp', ['ngAnimate'])
.controller('Ctrl', function($scope...