I have two selectboxes:
- Language Select box
- Some other Select box
Language
<select id="language" ng-model="languageID" ng-change="setLanguage()"
ng-options="option for option in languages" ng-selected="languageID"></select>
Some other
<select id="weekTitle" ng-model="weekTitleID" ng-change="setWeekTitle()"
ng-options="option for option in secondOptionsObject" ng-selected="weekTitleID">
Problem
When I set the language, the second box has to get it's options updated, for example:
English
Second select option one: "Hello" option two: "Hey there"
Dutch
Second select option one: "Hallo" option two: "Hallo daar"
Seems easy enough right? but when i first change the second box and then switchthe language, i get a white first option which is always selected, then When i switch back to the language i previously had it shows just two options (which is what i want). This is due to the fact that:
- The First Selectbox options are static ("English, Nederlands, Francais")
- The second selectbox options are dynamic ( This item is set everytime the language changes )
When this options object is changed by this line:
$scope.secondOptionsObject = [$scope.language["firstOption"],
$scope.language["secondOption"]]
I get the white line, every object and index has been check thoroughly and have been proved to be correct. The only thing that doesn't happen appearantly is an update of the options in this piece of code:
ng-options="option for option in secondOptionsObject"
When i do this, it works (but it's not what i want because the language changes):
$scope.secondOptionsObject = ["option1",
"option2"]