The default question mark always appears in the dropdown box today:
After Google's constant viewing of the data, it was found that Ng-model was not assigned and must be an object. property;
Wrong code:
$scope. localeoptions = [
{
ID: "ZH_CN",
Name: "Simplified Chinese"
},
{
ID: "ZH_TW",
Name: "Traditional Chinese"
}
];
$scope. Selectedlocale = $scope. localeoptions[0].id;
<select class= "Form-control" ng-options= "option.id as option.name for option in Localeoptions" Ng-model= " Selectedlocale "ng-change=" Changelocale () ">
</select>
The correct code:
$scope. localeoptions = [
{
ID: "ZH_CN",
Name: "Simplified Chinese"
},
{
ID: "ZH_TW",
Name: "Traditional Chinese"
}
];
$scope. localeoptions.id = $scope. localeoptions[0].id;
<select class= "Form-control" ng-options= "option.id as option.name for option in Localeoptions" Ng-model= " Localeoptions.id "ng-change=" Changelocale () ">
</select>