K
K
KOPC18862014-12-15 12:05:23
Angular
KOPC1886, 2014-12-15 12:05:23

Why does ng-options output an empty option when passed an array of booleans?

Why does ng-options output an empty option when passed an array of booleans?
There is such layout

<select id="autoAppl" class="form-control auto_applications" ng-model="serviceForm.auto" ng-options="opt.value as opt.title for opt in yesNoOptions">
                                </select>

array
$scope.yesNoOptions = [
                {value: 'N', title: 'Нет'},
                {value: 'Y', title: 'Да'}
            ];

If you make an array like this
$scope.yesNoOptions = [
                {value: false, title: 'Нет'},
                {value: true, title: 'Да'}
            ];

That creates an empty option and the select does not work correctly.
Why is that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2014-12-15
@FireGM

Can you use a checkbox?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question