#425 fix querystring detection in pathname mode

This commit is contained in:
Leo Horie 2015-01-25 23:25:17 -05:00
parent 6650023c63
commit 71980112b7

View file

@ -615,8 +615,10 @@ var m = (function app(window, undefined) {
}; };
var listener = m.route.mode === "hash" ? "onhashchange" : "onpopstate"; var listener = m.route.mode === "hash" ? "onhashchange" : "onpopstate";
window[listener] = function() { window[listener] = function() {
if (currentRoute != normalizeRoute($location[m.route.mode])) { var path = $location[m.route.mode]
redirect($location[m.route.mode]) if (m.route.mode === "pathname") path += $location.search
if (currentRoute != normalizeRoute(path)) {
redirect(path)
} }
}; };
computePostRedrawHook = setScroll; computePostRedrawHook = setScroll;
@ -659,7 +661,9 @@ var m = (function app(window, undefined) {
return routeParams[key] return routeParams[key]
}; };
m.route.mode = "search"; m.route.mode = "search";
function normalizeRoute(route) {return route.slice(modes[m.route.mode].length)} function normalizeRoute(route) {
return route.slice(modes[m.route.mode].length)
}
function routeByValue(root, router, path) { function routeByValue(root, router, path) {
routeParams = {}; routeParams = {};