From 742c7cd5f8e6029542158eba73b2429faecb70ae Mon Sep 17 00:00:00 2001 From: Andrew Buss Date: Sat, 16 May 2015 00:55:48 -0700 Subject: [PATCH] 'fixed' autocomplete. css still broke --- home.html | 4 +++- scripts/ClassAddController.js | 31 ++++++++++++++++++------------- templates/addclass.html | 33 ++++++++++++++++++--------------- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/home.html b/home.html index 944ef78..3ee4c9e 100644 --- a/home.html +++ b/home.html @@ -4,6 +4,8 @@ + + @@ -32,7 +34,7 @@ - + diff --git a/scripts/ClassAddController.js b/scripts/ClassAddController.js index ecd64ef..6fc0130 100644 --- a/scripts/ClassAddController.js +++ b/scripts/ClassAddController.js @@ -1,22 +1,27 @@ angular.module('flashy.ClassAddController', ['ui.router', 'angucomplete-alt', 'ngMaterial']). - controller('ClassAddController', ['$scope', '$state', '$http', function($scope, $state, $http) { + controller('ClassAddController', ['$scope', '$state', '$http', function ($scope, $state, $http) { - $scope.trySearch = function() { - return $http.get('/api/sections/search').then(function(response){ - return response.data; - })}; + $scope.trySearch = function (searchText) { + return $http.get('/api/sections/search/', { + params: { + q: searchText + } + }).then(function (response) { + return response.data; + }) + }; $scope.searchText = ""; /*$scope.trySearch = function() { - $http.get('/api/sections/search', [$scope.searchText]). - success(function(data) { - return data; - }). - error(function(err) { - console.log('you eejit'); - }); - };*/ + $http.get('/api/sections/search', [$scope.searchText]). + success(function(data) { + return data; + }). + error(function(err) { + console.log('you eejit'); + }); + };*/ }]); diff --git a/templates/addclass.html b/templates/addclass.html index 06a4f64..6b33731 100644 --- a/templates/addclass.html +++ b/templates/addclass.html @@ -1,19 +1,22 @@ -
- -
+
+ + - {{item.display}} - - No matches found. - + nd-no-cache="noCache" + md-selected-item="selectedItem" + md-search-text="searchText" + md-items="item in trySearch(searchText)" + md-item-text="item.short_name" + md-floating-label="Search Classes"> + + {{item.long_name}} + + + No matching classes found. + - - + + +
-- 1.9.1