Merge pull request #513 from gconsidine/ui/fix/lookup-component-empty-input

Set lookup value changed from something to nothing to be null
This commit is contained in:
Greg Considine 2017-10-09 13:09:35 -04:00 committed by Matthew Jones
commit 64c5e3994e
2 changed files with 6 additions and 6 deletions

View File

@ -32,7 +32,7 @@ function AtFormController (eventService, strings) {
vm.setListeners();
};
vm.register = (category, component, el) => {
vm.register = (category, component, el) => {
component.category = category;
component.form = vm.state;
@ -66,7 +66,7 @@ function AtFormController (eventService, strings) {
let data = vm.components
.filter(component => component.category === 'input')
.reduce((values, component) => {
if (!component.state._value) {
if (component.state._value === undefined) {
return values;
}

View File

@ -12,7 +12,7 @@ function atInputLookupLink (scope, element, attrs, controllers) {
inputController.init(scope, element, formController);
}
function AtInputLookupController (baseInputController, $q, $state, $stateParams) {
function AtInputLookupController (baseInputController, $q, $state) {
let vm = this || {};
let scope;
@ -75,13 +75,14 @@ function AtInputLookupController (baseInputController, $q, $state, $stateParams)
vm.resetDebounce = () => {
clearTimeout(vm.debounce);
vm.searchAfterDebounce();
vm.searchAfterDebounce();
};
vm.search = () => {
scope.state._touched = true;
if (scope.state._displayValue === '' && !scope.state._required) {
scope.state._value = null;
return vm.check({ isValid: true });
}
@ -116,8 +117,7 @@ function AtInputLookupController (baseInputController, $q, $state, $stateParams)
AtInputLookupController.$inject = [
'BaseInputController',
'$q',
'$state',
'$stateParams'
'$state'
];
function atInputLookup (pathService) {