diff --git a/amd-router.js b/amd-router.js index c9c022c..bc201f9 100644 --- a/amd-router.js +++ b/amd-router.js @@ -125,9 +125,9 @@ } } + var pattern = '^' + regexPattern.join('\\/') + '/?$'; if (placeholders.length > 0) { // combine the regex parts to form the final regex pattern - var pattern = '^' + regexPattern.join('\\/') + '$'; return new Route({ route : route, tokens : tokens, @@ -137,7 +137,8 @@ } else { // path contains no placeholders so we will only need to check for exact match return new Route({ - route : route + route : route, + regex : new RegExp(pattern) }) } @@ -244,4 +245,4 @@ define('amd-router', ModuleFactory); } } -})(); \ No newline at end of file +})();