(js) Improve sg-search directive

This commit is contained in:
Francis Lachapelle
2016-02-25 10:10:53 -05:00
parent e5fe211dcd
commit b294c5381a
3 changed files with 6 additions and 3 deletions
@@ -123,7 +123,7 @@
input = form[vm.inputName],
rawSearchText = input.$viewValue;
if (vm.allowDot && rawSearchText == '.' || form.$valid) {
if (vm.allowDot && rawSearchText == '.' || form.$valid && rawSearchText) {
if (rawSearchText == '.')
// Ignore the minlength constraint when using the dot operator
input.$setValidity('minlength', true);
@@ -274,7 +274,7 @@
angular.extend(options, { sortingAttributes: Mailbox.$query });
if (angular.isDefined(filters)) {
options.filters = _.reject(filters, function(filter) {
return angular.isUndefined(filter.searchInput) || filter.searchInput.length === 0;
return !filter.searchInput || filter.searchInput.length === 0;
});
// Decompose filters that match two fields
_.each(options.filters, function(filter) {