角度ng-Animate在1.26之后不起作用

时间:2015-09-08 09:01:13

标签: javascript css angularjs

我使用- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { YourCustomCell *customCell = (YourCustomCell *)cell; [cell.cityButton updateLayout]; } 代替ng-animate,as it has changed with 1.2。但是我似乎无法让下面的工作。我错过了什么?

CSS:

class="animationName"

HTML:

 .move-animation.ng-move {
    -webkit-transition:all linear 1s;
    -moz-transition:all linear 1s;
    -ms-transition:all linear 1s;
    -o-transition:all linear 1s;
    transition:all linear 1s;
     max-height: 0;
    opacity:0;
}
  .move-animation.ng-move.ng-move-active {
    max-height: 250px;
    opacity:1;
}

控制器:

    <div ngApp="MyApp">
    <div ng-controller="App">
        <button ng-click="add()">Add</button>
        <ul>
            <li class="move-animation" ng-click="remove($index)" ng-repeat="name in names">{{name}}</li>
        </ul>
    </div>
</div>

这是1.26:http://jsfiddle.net/6t42M/178/ 这是一个相同的年龄小提琴,1.1。它正在运作:http://jsfiddle.net/6t42M/100/

1 个答案:

答案 0 :(得分:0)

工作小提琴,1.4.2。

JS:

    angular.module('MyApp', ['ngAnimate'])
.controller('AppController', ['$scope', function ($scope) {
    $scope.names = [];
    var data = [];
    for (var i = 0; i < 100; i++) {
        data.push('item' + i)
    }   
    $scope.add = function () {
        if (data.length) $scope.names.splice(0, 0, data.pop());
    };
}]);

HTML:

<div ngApp="MyApp">
    <div ng-controller="AppController">

        <button ng-click="add()">Add</button>
        <ul>
            <li class="fadeLine" ng-repeat="name in names">{{name}}</li>
        </ul>
    </div>
</div>

CSS:

 .fadeLine.ng-enter {
    transition:0.5s linear all;
      opacity:0;
}
  .fadeLine.ng-enter-active {
        opacity:1;
}