I have the following angular route:
$routeProvider.when('/sites/:var1/:var?/something/:year?/:month?/', {
templateUrl: 'path-to-template.html,
controller: 'PageController'
});
$locationProvider.html5Mode(true);
The problem is that when i hit the route http://www.somesite.com/sites/category/something/2014/10/ Angular tries to match the optional named groups and in the end transforms the url to http://www.somesite.com/sites/category/%3F/something/2014%3F/10%3F/ and redirects me to the that path.
Does anyone knows of any good reason why the optional path would be replaces by /?/ (encoded: %3F)?
Any help is greatly appreciated. Thank you
EDIT
What happens is that router in angular replaces the url to match exactly what you provide in the .when, in terms of / ? (and not sure what else). So if it finds a route matching .when but missing either / or ? it just appends it and refreshes (angular refresh) and then apparently url encodes it. (??? :o)