i have array of available select items:
// Default available date formats
$scope.dateformats = [
{
code: 'YY.MM.DD',
name: 'YY.MM.DD'
},
{
code: 'DD.MM.YY',
name: 'DD.MM.YY'
}
];
And I'm trying to default preselected value like this:
$scope.actualDateformat = $scope.dateformats[0].code;
<select ng-options="dateformat.name for dateformat in dateformats" ng-model="actualDateformat" ng-change="changeDateFormat(dateformat)">
<option style="display:none" value="">{{actualDateformat}}</option>
</select>
Problem is, that "preselected" value appears in list as first option tag>
<option style="display:none" value="">{{actualDateformat}}</option>
After select of any from two remaining dynamically added items is text in first option appended with text (and value) of the selected item.
How can in solve it please?
I would like to have result like this:
<select>
<option value="YY.MM.DD">YY.MM.DD</option>
<option value="DD.MM.YY" selected>DD.MM.YY</option>
</select>
Thanks for any help.