mirror of
https://github.com/nasa/openmct.git
synced 2025-02-01 00:45:41 +00:00
[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:
parent
c92d15ba42
commit
457193657f
@ -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>
|
||||
|
||||
|
@ -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;
|
||||
});
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user