Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div ng-controller="MyController" >
- <button ng-click="changeAll()">Change</button>
- <ul>
- <li class="item" ng-repeat="i in myList">{{i}}</li>
- </ul>
- </div>
- var MyApp = angular.module('MyApp', ['ngAnimate'])
- MyApp.controller('MyController', ['$scope',function($scope){
- $scope.list_a = ["Item A","Item B","Item C"];
- $scope.list_b = ["Item D","Item E","Item F", "Item G"];
- $scope.myList = $scope.list_a;
- $scope.changeAll = function(){
- $scope.myList = $scope.myList.length == 3 ? $scope.list_b : $scope.list_a;
- }
- }]);
- .item.ng-enter,
- .item.ng-leave{
- transition:all 1s ease;
- }
- .item.ng-enter,
- .item.ng-leave.ng-leave-active{
- opacity:0;
- }
- .item.ng-enter.ng-enter-active,
- .item.ng-leave{
- opacity:1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement