[Search] Moved isLoading

Moved the isLoading function away from
the aggregator. It is now the controller's
responsibility. Corresponding tests
updated.
This commit is contained in:
slhale
2015-08-03 10:25:23 -07:00
parent 19b9668190
commit eb0bdba666
4 changed files with 19 additions and 33 deletions

View File

@ -33,11 +33,15 @@ define(function () {
function SearchController($scope, searchService) {
// Starting amount of results to load. Will get increased.
var numResults = INITIAL_LOAD_NUMBER,
loading = false,
fullResults = [];
function search() {
var inputText = $scope.ngModel.input;
// We are starting to load.
loading = true;
// Update whether the file tree should be displayed
if (inputText === '' || inputText === undefined) {
$scope.ngModel.search = false;
@ -52,6 +56,9 @@ define(function () {
searchService.query(inputText).then(function (result) {
fullResults = result.hits;
$scope.results = result.hits.slice(0, numResults);
// Now we are done loading.
loading = false;
});
}
@ -67,7 +74,7 @@ define(function () {
* fully updated.
*/
isLoading: function () {
return searchService.isLoading();
return loading;
},
/**