Search for new released movies:
This is a simple autocomplete directive for AngularJS, packaged in a Angular module. You can check out the source code or download it here:
diff --git a/script/app.js b/script/app.js
index be9cd3a..602ae04 100644
--- a/script/app.js
+++ b/script/app.js
@@ -38,6 +38,10 @@ app.controller('MyCtrl', function($scope, MovieRetriever){
return $scope.movies;
}
+ $scope.clearSearch = function() {
+ $scope.result = '';
+ };
+
$scope.doSomething = function(typedthings){
console.log("Do something like reload data with this: " + typedthings );
$scope.newmovies = MovieRetriever.getmovies(typedthings);
diff --git a/script/autocomplete.js b/script/autocomplete.js
index 377ad0f..92302a8 100644
--- a/script/autocomplete.js
+++ b/script/autocomplete.js
@@ -47,7 +47,7 @@ app.directive('autocomplete', function() {
return;
}
- if(watching && typeof $scope.searchParam !== 'undefined' && $scope.searchParam !== null) {
+ if(watching && $scope.searchParam) {
$scope.completing = true;
$scope.searchFilter = $scope.searchParam;
$scope.selectedIndex = -1;
diff --git a/style/style.css b/style/style.css
index cc370d6..35dac01 100644
--- a/style/style.css
+++ b/style/style.css
@@ -24,6 +24,15 @@ a:hover{
transition: 0.1s all ease-in-out;
}
+.main button {
+ padding: 8px 16px;
+ font-size: 1.2em;
+ background: #eee;
+ border: 1px solid #999;
+ color: #444;
+ margin: 20px;
+}
+
body{
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
min-height:100%;