Make it work

This commit is contained in:
Tyler Rockwood 2017-05-15 14:32:06 -07:00
parent 4ecc8da398
commit 0046cfa3ee
3 changed files with 9 additions and 6 deletions

View File

@ -25,7 +25,7 @@
</div>
<div class="form-group" ng-if="$ctrl.parameter.type === 'enum'">
<label>Values (newline delimited)</label>
<textarea class="form-control" rows="3" ng-model="$ctl.parameter.enumOptions">
<textarea class="form-control" rows="3" ng-model="$ctrl.parameter.enumOptions">
</div>
</div>
</div>

View File

@ -6,8 +6,8 @@
<input ng-switch-when="datetime-with-seconds" type="datetime-local" step="1" class="form-control" ng-model="param.ngModel">
<input ng-switch-when="datetime-local" type="datetime-local" class="form-control" ng-model="param.ngModel">
<input ng-switch-when="date" type="date" class="form-control" ng-model="param.ngModel">
<span ns-switch-when="enum">
<select ns-model="param.value" class="form-control">
<span ng-switch-when="enum">
<select ng-model="param.value" class="form-control">
<option ng-repeat="option in extractEnumOptions(param.enumOptions)" value="{{option}}">{{option}}</option>
</select>
</span>

View File

@ -40,10 +40,13 @@ function ParametersDirective($location, $uibModal) {
});
}, true);
}
// These are input as newline delimited values,
// so we split them here.
scope.extractEnumOptions = (enumOptions) => {
// These are input as newline delimited values,
// so we split them here.
return enumOptions.split('\n');
if (enumOptions) {
return enumOptions.split('\n');
}
return [];
};
scope.showParameterSettings = (param) => {
$uibModal.open({