-
Notifications
You must be signed in to change notification settings - Fork 9
Multi url for states (e.g. multilingual) #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can use the route provider: https://github.com/dotJEM/angular-routing/wiki/Route-provider---basic-configuration for aliased states angular.module('phonecat', ['dotjem.routing']).
config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/phones', { state: 'phones' })
.when('/otherphones', { state: 'phones' });
}]); As for your example of locales, I would make locale a parameter ( |
As i understand, in this case, i can redirect different urls to same state. e.g.: angular.module('phonecat', ['dotjem.routing']).
config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/{locale}/phones', { state: 'phones'})
.when('/{locale}/telefoni', { state: 'phones'})
}]); But what about reverse, generating urls with $state.url ? |
You may configure the primary URL on the state, and that will be used when using $state.url... |
Maybe you didn't understand my point. I want to generate seo multilingual urls (optimizing for search engines) |
That is safe to say, out of the scope of the router, as it would be a very complex scenario and there are more prioritized things atm... getting ready for 1.3 being one thing. If you could settle for having just one active route set at one time. (so when en. is selected only those routes are available)... You could look into loading states dynamically. See #19 And use $state.reinitialize whenever you change locale... That is the best built in thing I can think of... Otherwise you will need to use $route.format your self. |
Is there a way to define multi urls for state?
I am searching for this solution for a long time ... i made plugin for ui-router, custom url matcher ... but it's a little bit hacky and every new version i must update it... you can check it how it works on http://naslovnice.si.
I guess it would be so easy if route parameter could be also a function e.g.:
This could also be used for state's url aliases ...
What do you think?
The text was updated successfully, but these errors were encountered: