Select Not Showing Selected Values – AngularJs

Hey everyone,

I had a bit of trouble getting a selected option to show up with AngularJs. It turned out that I needed to add an ng-selected attribute:

    {{command.Status}}
    <select ng-model="command.Status">
        <option ng-selected="command.Status == 0" value="0">Enabled</option>
        <option ng-selected="command.Status == 1" value="1">Disabled</option>
        <option ng-selected="command.Status == 2" value="2">Deleted</option>
    </select>

Check out this Stackoverflow post for more info: http://stackoverflow.com/a/18336858/522859

Leave a Reply