Skip to content

Commit

Permalink
Add null option to select widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Rupert Bedford committed Oct 5, 2016
1 parent 88732c1 commit 17f7e85
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/marmoset/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,17 @@ function marmosetSelectWidget($compile) {
field: '=marmosetSelectWidget'
},
link: function(scope, element) {
// TODO null option

var e = angular.element('<select></select>');
e.attr('class', 'form-control');
e.attr('name', scope.field.name);
e.attr('ng-model', 'field.data[field.name]');
e.attr('ng-options', 'x.value as x.label for x in field.options');
e.attr('ng-required', 'field.required()');

// null option
var option = angular.element('<option></option>');
e.append(option);

element.append(e);
$compile(e)(scope);
}
Expand Down

0 comments on commit 17f7e85

Please sign in to comment.