Arnaud Vandecasteele
unread,Apr 26, 2013, 7:30:19 AM4/26/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ang...@googlegroups.com
Hello,
I'm playing with Angular and I'm quite impress by the potentiality of this framework.
But there is still something I don't understand. I want to be able to change the view text depending on the languages used by the person.
When they click on a language (e.g., french, english), the URL change as mywebsite/#language/fr or mywebsite/#/language/en
As the name of my template are al the same (e.g. fr-description.html, en-description.html), is there a way to set a dynamic templateURL instead of defining a new routeProvider for each language ?
For example :
angular.module('OSMQmodule', []).
config(['$routeProvider', '$locationProvider', function($routeProvider, $routeParams) {
$routeProvider.
when('/language/:language', {
templateUrl: "./res/tpl/" + $locationProvider.language + "-description.html",
controller: OSMQ.CONTROLLERS.OSMQSwitchLanguageCtrl
}).
otherwise({redirectTo: '/'});
}
]);
Thanks for your help
Arnaud