Monday, 15 March 2010

javascript - AngularJS ngOptions object not being updated in html multi-language -



javascript - AngularJS ngOptions object not being updated in html multi-language -

i have 2 selectboxes:

language select box some other select box

language

<select id="language" ng-model="languageid" ng-change="setlanguage()" ng-options="option alternative in languages" ng-selected="languageid"></select>

some other

<select id="weektitle" ng-model="weektitleid" ng-change="setweektitle()" ng-options="option alternative in secondoptionsobject" ng-selected="weektitleid">

problem

when set language, sec box has it's options updated, example:

english

second select option one: "hello" option two: "hey there"

dutch

second select option one: "hallo" option two: "hallo daar"

seems easy plenty right? when first alter sec box , switchthe language, white first alternative selected, when switch language had shows 2 options (which want). due fact that:

the first selectbox options static ("english, nederlands, francais") the sec selectbox options dynamic ( item set everytime language changes )

when options object changed line:

$scope.secondoptionsobject = [$scope.language["firstoption"], $scope.language["secondoption"]]

i white line, every object , index has been check thoroughly , have been proved correct. thing doesn't happen appearantly update of options in piece of code:

ng-options="option alternative in secondoptionsobject"

when this, works (but it's not want because language changes):

$scope.secondoptionsobject = ["option1", "option2"]

javascript angularjs multilanguage ng-options

No comments:

Post a Comment