[Search] Added input ID parameter

Added a parameter to the controller's search
function so that the html side can clearly
see/choose which input ID is being used as
the search input.
This commit is contained in:
shale 2015-07-14 09:59:48 -07:00
parent c92d15ba42
commit 457193657f
2 changed files with 14 additions and 5 deletions

View File

@ -31,7 +31,7 @@
value=""/>
<span class="button">
<button type="button"
ng-click="controller.search()">Go</button>
ng-click="controller.search('searchinput')">Go</button>
</span>
</div>

View File

@ -77,8 +77,17 @@ define(function () {
}
// Use elasticsearch's search to search through all the objects
function searchElastic() {
var searchTerm = document.getElementById("searchinput").value;
function searchElastic(inputID) {
var searchTerm;
// Get the user input
if (inputID) {
searchTerm = document.getElementById(inputID).value;
} else {
// Backward compatibility?
// TODO: May be unnecsisary
searchTerm = document.getElementById("searchinput").value;
}
// Get the data...
return $http({
@ -131,8 +140,8 @@ define(function () {
return {
// Search the database using the user input of id "searchinput"
search: function () {
searchElastic().then( function (c) {
search: function (inputID) {
searchElastic(inputID).then( function (c) {
$scope.results = c;
});
},