LastTribunal LastTribunal - 3 months ago 7
AngularJS Question

Fade in effect for ng-repeat, for inserting elements at the top of a list

I've seen examples on how to fade in when adding elements to the bottom, but not to the top.

Answer

please find the code for app.js (from your sample link in you comment) below:

angular.module("userApp", ['ngAnimate'])
.controller('MainCtrl', function($scope) {
    $scope.usrList = [];
    $scope.adduser = function() {
        console.log($scope.newUsr)

        var item = {name: $scope.newUsr};
        $scope.usrList.splice(0, 0, item);
    }

});
Comments