0

I have set of options to bind to a select box.

Say the array is defined like whose content is to be bind to the dropdown.

$scope.options = [
        { City: "en", },
        { City: "nl" },
        ....
        ....
        like so
    ];

And the typical code to bind the above options

<select ng-model="selectedcity"                 
            ng-options="i.City for i in options">
</select>

This works fine.

But I would like to implement language specific options.

So what is the correct way to translate this City values and bind to dropdown.Because I have multilingual site where I would need to show the dropdowns in different languages.

Navoneel Talukdar
  • 4,393
  • 5
  • 21
  • 42

1 Answers1

1

Take a look at ngTranslate and this posts

How to ng-translate inside select box option in angularjs

angular-translate ad ng-options

Basically you are using the translate filter in the options expression like

<select ng-model="selectedcity"                 
        ng-options="i.City | translate for i in options">
</select>
Community
  • 1
  • 1
Rob
  • 5,353
  • 33
  • 34