How to ng-translate inside select box option in angularjs
You need to apply the filter to gender.name and not to the genders array: <select ng-model=”me.gender” ng-options=”gender.name | translate for gender in genders”></select> Here is a demo
You need to apply the filter to gender.name and not to the genders array: <select ng-model=”me.gender” ng-options=”gender.name | translate for gender in genders”></select> Here is a demo
this is how I do it JAVASCRIPT: var module = angular.module(‘yourModuleName’, [‘ui.router’]); module.run( [‘$rootScope’, ‘$state’, ‘$stateParams’, function ($rootScope, $state, $stateParams) { $rootScope.$state = $state; $rootScope.$stateParams = $stateParams; } ]); HTML: <pre id=”uiRouterInfo”> $state = {{$state.current.name}} $stateParams = {{$stateParams}} $state full url = {{ $state.$current.url.source }} </pre> EXAMPLE http://plnkr.co/edit/LGMZnj?p=preview
$translate.use() is a getter and setter. See this demo found in links of docs: http://jsfiddle.net/PascalPrecht/eUGWJ/7/
Recommended: don’t translate in the controller, translate in your view I’d recommend to keep your controller free from translation logic and translate your strings directly inside your view like this: <h1>{{ ‘TITLE.HELLO_WORLD’ | translate }}</h1> Using the provided service Angular Translate provides the $translate service which you can use in your Controllers. An example usage … Read more