don't ignore choices param in input config

We always want to use choices if they're available in the input config
from the api. An input can sometimes have no type. Usually we'd throw an
error but we can still load a component if it defines a set of choices
to use instead of a type.
This commit is contained in:
Jake McDermott 2019-03-22 10:19:04 -04:00
parent 956f588fd8
commit da9abc087e
No known key found for this signature in database
GPG Key ID: 9A6F084352C3A0B7

View File

@ -114,12 +114,16 @@ function AtInputGroupController ($scope, $compile) {
config._component = 'at-input-checkbox';
} else if (input.type === 'file') {
config._component = 'at-input-file';
} else if (input.choices) {
}
if (input.choices) {
config._component = 'at-input-select';
config._format = 'array';
config._data = input.choices;
config._exp = 'choice for (index, choice) in state._data';
} else {
}
if (!config._component) {
const preface = vm.strings.get('group.UNSUPPORTED_ERROR_PREFACE');
throw new Error(`${preface}: ${input.type}`);
}