-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathng-repeat.html
75 lines (66 loc) · 2.3 KB
/
ng-repeat.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!doctype html>
<html ng-app="test">
<head>
<meta charset="utf-8">
<title>Top Animation</title>
<!-- <script>document.write('<base href="' + document.location + '" />');</script> -->
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<style>
.item{
// opacity:0;
position: relative;
top: -50px;
height: 0px;
//-webkit-transition: all linear 300ms;
//transition: all linear 300ms;
-webkit-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-moz-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-ms-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-o-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
}
.item.visible{
// opacity:1;
top: 0px;
height: 30px;
}
</style>
<script>
var myApp = angular.module('test',[]);
myApp.directive('itemInit', function ($compile) {
return function (scope, element, attrs) {
scope.initItem(element);
};
});
myApp.controller('testCtrl',function($scope,$timeout) {
$scope.limit=3;
$scope.initItem = function(el){
$timeout(function(){
angular.element(el).addClass('visible');
},0);
}
$scope.viewAllName = function() {
$scope.limit=$scope.names.length;
}
});
</script>
</head>>
<body ng-controller="testCtrl" ng-init="names=['Igor Minar', 'Brad Green', 'Dave Geddes', 'Naomi Black', 'Greg Weber', 'Dean Sofer', 'Wes Alvaro', 'John Scott', 'Daniel Nadasi'];">
<div class="well" style="margin-top: 30px; width: 200px; overflow: hidden;">
<form class="form-search">
<div class="input-append">
<input type="text" ng-model="search" class="search-query" style="width: 80px">
<button type="submit" class="btn">Search</button>
</div>
<ul class="nav nav-pills nav-stacked">
<!-- <li ng-animate="'animate'" ng-repeat="name in names | filter:search">
<a href="#"> {{name}} </a>
</li> -->
<button ng-click="viewAllName()">click</button>
<li ng-repeat="name in names | filter:search | limitTo:limit" class="item" item-init>{{name}}</li>
</ul>
</form>
</div>
</body>
</html>