-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
54 lines (53 loc) · 1.4 KB
/
test.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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="/angular-autocomplete.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.9/angular.js"></script>
<script src="/angular-autocomplete.js"></script>
<script>
angular.module('demo', [ 'mp.autocomplete' ]).controller('TestController', function($scope, $q) {
$scope.fetchMatches = function (text) {
var deferred = $q.defer();
deferred.resolve([1, 2, 3, 4, 5, 6].map(function(i) {
return text + i.toString();
}));
return deferred.promise;
};
$scope.display = function () {
console.log('Hello');
}
});
</script>
<style type="text/css">
ul.angular-autocomplete {
display: block;
list-style: none;
padding: 0;
border: 1px solid gray;
}
ul.angular-autocomplete > li {
padding: 5px 10px;
}
li.selected {
color: red;
}
</style>
</head>
<body>
<article ng-app="demo">
<section class="showcase">
<div class="content-wrap">
<div class="showcase-example" ng-controller="TestController">
<input type="text"
ng-model="color"
autocomplete="fetchMatches"
on-suggestion-selected="display()"
>
</div>
</div>
</section>
</article>
</body>
</html>