Book Image

AngularJS UI Development

By : Amit Gharat, Matthias Nehlsen
Book Image

AngularJS UI Development

By: Amit Gharat, Matthias Nehlsen

Overview of this book

<p>AngularJS and its rich set of components solve many of the problems developers face when writing reliable single page applications in ways that would not be possible using other frameworks. This book will help you expand your horizons by teaching you the skills needed to successfully design, customize, build, and deliver real-world applications in AngularJS. We will start off by setting up a fully automated environment to quickly scaffold, test, and deploy any application. Along the way, we'll cover how to design and build production-ready applications to demonstrate how innovative and powerful AngularJS is. By leveraging CSS3 animations, we'll convert them into intuitive and native-like applications in no time. You will also learn how to use Grunt for application-specific task management, Bower to manage dependencies with external libraries/plugins, Git for better versioning, and Karma and Protractor for automated testing to build applications the way experts do.</p> <p>You will learn all this by building real-world applications including a to-do application, Github dashboard, project management application, and many more.</p>
Table of Contents (17 chapters)
AngularJS UI Development
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

JavaScript-defined animations


We may have to rely on JavaScript sometimes to perform the animation because of browser compatibility issues with CSS animations/transitions. As you know, the moment we introduce ngAnimate as a dependency to our application, the $animate service starts adding/removing the ng-* classes on/off the elements during the course of the animation, but within 0 ms, in case we do not have the CSS animations in place. This gives us a control over how we want to enable the animation, that is, either using CSS or JavaScript.

Let's create a JavaScript fallback for the example from the Using animate.css section. Add the following to controllers.js:

.animation('.item', function() {
    return {
        enter: function(element, done) {
            element.css({'opacity': 0, 'margin-left': '-230px'});
            element.animate({'opacity': 1, 'margin-left': 0}, 500, done);
        },
        leave: function(element, className, done) {element.animate({'opacity': 0, 'margin-left...