Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <div ng-controller="MyController" >
  2. <button ng-click="changeAll()">Change</button>
  3. <ul>
  4. <li class="item" ng-repeat="i in myList">{{i}}</li>
  5. </ul>
  6. </div>
  7.  
  8. var MyApp = angular.module('MyApp', ['ngAnimate'])
  9. MyApp.controller('MyController', ['$scope',function($scope){
  10. $scope.list_a = ["Item A","Item B","Item C"];
  11. $scope.list_b = ["Item D","Item E","Item F", "Item G"];
  12. $scope.myList = $scope.list_a;
  13.  
  14. $scope.changeAll = function(){
  15. $scope.myList = $scope.myList.length == 3 ? $scope.list_b : $scope.list_a;
  16. }
  17. }]);
  18.  
  19. .item.ng-enter,
  20. .item.ng-leave{
  21. transition:all 1s ease;
  22. }
  23.  
  24. .item.ng-enter,
  25. .item.ng-leave.ng-leave-active{
  26. opacity:0;
  27. }
  28.  
  29. .item.ng-enter.ng-enter-active,
  30. .item.ng-leave{
  31. opacity:1;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement