Select Git revision
search.js 1.02 KiB
angular.module('searchApp', []).controller('SearchController',
[ '$scope', '$http', function($scope, $http) {
$scope.columns =
{ id : false
, errLevel : true
, errType : false
, fileName : true
, shortMsg : true
, longMsg : false };
$scope.colProps = [];
for (k in $scope.columns) if (k != 'id') { $scope.colProps.push(k)} ;
$scope.field = 'shortMsg';
$scope.results = [];
$scope.number = 0;
$scope.maxNumber = 100;
$scope.searchText = '';
$scope.query = function () { return '/' + $scope.field +
'?limit=' + $scope.maxNumber +
'&text=' + $scope.searchText;
};
$scope.search = function() {
if ($scope.searchText) {
$http.get('search' + $scope.query()).success(function(data) {
$scope.results = data;
});
};
$scope.count();
};
$scope.count = function() {
$http.get('count' + $scope.query()).success(function(data) {
$scope.number = data[0].count;
});
};
} ]);