A Pen by Joey Nichols on CodePen.
Created
July 1, 2015 02:36
-
-
Save AnanthaRajuC/a533b63ea282611c8e91 to your computer and use it in GitHub Desktop.
AngularJS Animations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body ng-app="todoTest"> | |
<div ng-controller="TodoCtrl"> | |
<div class="container"> | |
<h1 class="page-header text-center">Angular Animations Test</h1> | |
<form ng-submit="addTodo(newTodo)"> | |
<input type="text" ng-model="newTodo" placeholder="New Todo item goes here" class="form-control" focus/> | |
</form> | |
<br /> | |
<div class="list-group"> | |
<div class="list-group-item todo-item" ng-repeat="item in items" ng-class="{ 'todo-complete': item.complete }"> | |
<span class="close" ng-click="removeTodo($index)">×</span> | |
<label> | |
<input type="checkbox" ng-model="item.complete" /> | |
<span ng-bind="item.text">This is the content of the todo</span> | |
</label> | |
</div> | |
</div> | |
<button class="btn btn-danger btn-block" ng-click="clearAll()">Clear all items</button> | |
</div> | |
</div> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module("todoTest", ["ngAnimate"]); | |
app.controller("TodoCtrl", function($scope) { | |
$scope.items = [{ text: "This is a sample todo", complete: true }]; | |
$scope.newTodo = ""; | |
$scope.addTodo = function() { | |
$scope.items.push({ text: $scope.newTodo, complete: false }); | |
$scope.newTodo = ""; | |
}; | |
$scope.removeTodo = function(index) { | |
$scope.items.splice(index, 1); | |
} | |
$scope.clearAll = function() { | |
$scope.items = []; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.min.js"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-animate.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.todo-item { | |
transition: background-color 0.3s, color 0.6s; | |
label { display: block; } | |
&.ng-enter { | |
animation: fadeInLeft 1s; | |
} | |
&.ng-leave { | |
animation: bounceOut 1s; | |
} | |
} | |
.todo-complete { | |
background-color: #f3f3f3; | |
color: #777; | |
label { | |
text-decoration: line-through; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" /> | |
<link href="//cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.3/animate.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment