Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app="demo" ng-controller="list">
  <div class="con">
    <div class="item" 
    ng-repeat="a in p track by $index"
    ng-animate="{enter:'in',leave:'out'}"
    ng-click="itemClick($index)"
    ng-class="{current:selected[$index]=='true'}">
      {{a}}
    </div>
    
  </div>
  <button ng-click="fuck()">add</button>
</body>
</html>
 
.con{border:1px solid green;width:400px;height:300px;overflow-y:scroll;}
.item{border:1px solid lightblue;float:left;height:100px;width:100px;margin:10px;background-color:lightblue;}
.current{border:1px solid pink;background-color:pink;}
.in {
    -webkit-transition: 1s linear all; /* Chrome */
    transition: 1s linear all;
    opacity: 0;
}
 
.in.in-active {
    opacity: 1;
}
 
var demo = angular.module('demo',[]);
demo.controller('list',function($scope){
  $scope.selected = {};
  $scope.alist = [
    { name:'fuck'},
    { name:'fuck'},
    { name:'fuck'},
    { name:'fuck'}
  ];
  $scope.p = ['a','sd','ds','sdf'];
  $scope.fuck = function() {
    $scope.p.push('fff');
    
  };
  $scope.itemClick = function(index){
    alert(index);
     $scope.selected[index] = 'true';  
  };
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
pensacola1989pro
0viewers