diff --git a/brewman/brewman/static/partial/employee-list.html b/brewman/brewman/static/partial/employee-list.html
index 49bd661e..41408c3a 100644
--- a/brewman/brewman/static/partial/employee-list.html
+++ b/brewman/brewman/static/partial/employee-list.html
@@ -23,7 +23,7 @@
-
+
{{item.Code}} |
{{item.Name}} |
{{item.Designation}} |
diff --git a/brewman/brewman/static/scripts/employee.js b/brewman/brewman/static/scripts/employee.js
index 65e6ec1d..1fb296ee 100644
--- a/brewman/brewman/static/scripts/employee.js
+++ b/brewman/brewman/static/scripts/employee.js
@@ -12,7 +12,11 @@ var EmployeeListCtrl = ['$scope', '$location', '$routeParams', 'employees', func
});
};
- $scope.getEmployees = function (q) {
+ $scope.$watch('search', function (newValue, oldValue) {
+ $scope.filterEmployees(newValue);
+ }, true);
+
+ $scope.filterEmployees = _.debounce(function (q) {
if (q !== $scope._search) {
$scope._search = q;
if (angular.isUndefined(q) || q === '') {
@@ -20,9 +24,11 @@ var EmployeeListCtrl = ['$scope', '$location', '$routeParams', 'employees', func
} else {
$location.path('/Employees').search({'q': q}).replace();
}
+ $scope.$apply(function () {
+ $scope.employees = $scope.doFilter(q);
+ });
}
- return $scope.doFilter(q);
- };
+ }, 350);
$scope.doFilter = _.memoize(function (q) {
var matches = [], i, len;
if (angular.isUndefined(q) || q === '') {