Home selected boolean value on angular ng-options
Reply: 0

selected boolean value on angular ng-options

user786
1#
user786 Published in April 27, 2018, 8:30 am

The boolean value assigned to the model doesn't pre-select the corresponding option - shows first an empty option instead:

Select:

<select data-ng-model="scriptData.privacy" data-ng-options="privacyOption.value as privacyOption.label for privacyOption in privacyOptionsSelect track by privacyOption.value"></select>

Options in the controller:

$scope.privacyOptionsSelect=[
            {
                label:'Registered users only can view this',
                value: false
            },
            {
                label:'Anyone with the link can view this',
                value: true
            }
        ];

scriptData.privacy is set to false.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.325168 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO