I am curious to use ng-options and ng-model to set the selected item for the model, why the Angular DOM markup does not display the correct value, but the correct value is still displayed.
$scope.myArray = [{ value: 'Yes' }, { value: 'No' }];
$scope.cboModel.myArrayValSel =
<select ng-model="cboModel.myArrayValSel " ng-options="val.value as val.value for val in myArray " />
DOM markup renders:
<option selected="selected" value="0" label="Yes">Yes</option>
<option value="1" label="No">No</option>
So, if the value is returned as “No” for the property of the object model, it is displayed in the drop-down list respectively in the browser, but I don’t understand why it does not set the selected = “selected” attribute to the second element in the array. In this case, on
<option value="1" label="No">No</option>.
, , HTML PDF. PDF , , , , , PDF.