function navTo(path) {
// $location.path() does not want a leading ".",
- // which <a>'s will have
+ // which <a>'s will have.
+ // Note: avoid using $location.path() to derive the new
+ // URL, since it creates an intermediate path change.
path = path.replace(/^\./,'');
-
- // navigates to the requested path as a new page
- $window.location.href = $location.path(path).absUrl();
+ var reg = new RegExp($location.path());
+ $window.location.href =
+ $window.location.href.replace(reg, path);
}
// adds a keyboard shortcut
$scope.applyLocale = function(locale) {
// EGWeb.pm can change the locale for us w/ the right param
+ // Note: avoid using $location.search() to derive a new
+ // URL, since it creates an intermediate path change.
+ // Instead, use the ham-fisted approach of killing any
+ // search args and applying the args we want.
$window.location.href =
- $location.search('set_eg_locale', locale).absUrl();
+ $window.location.href.replace(
+ /(\?|\&).*/,
+ '?set_eg_locale=' + encodeURIComponent(locale)
+ );
}
// tied to logout link