aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGonzalo Ruiz de Villa2012-12-11 11:41:53 +0100
committerIgor Minar2012-12-14 01:16:07 +0100
commit4c6b4447dba9b9027ddf14eae548f7ea0ef6f900 (patch)
treee9974efd10f4cf609243d28da09873e77be35f39 /src
parent741a37b3389e2c129ddb807f10ccc7b69b4140be (diff)
downloadangular.js-4c6b4447dba9b9027ddf14eae548f7ea0ef6f900.tar.bz2
fix($route): correctly extract $routeParams from urls
Routes like '/bar/foovalue/barvalue' matching '/bar/:foo/:bar' now are well mapped in $routeParams to: {bar:'barvalue', foo:'foovalue'} Closes: #1501 Signed-off-by: Gonzalo Ruiz de Villa <gonzaloruizdevilla@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/ng/route.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ng/route.js b/src/ng/route.js
index e2a9c633..361b8ac3 100644
--- a/src/ng/route.js
+++ b/src/ng/route.js
@@ -321,12 +321,12 @@ function $RouteProvider(){
var regex = '^' + when.replace(/([\.\\\(\)\^\$])/g, "\\$1") + '$',
params = [],
dst = {};
- forEach(when.split(/\W/), function(param) {
- if (param) {
- var paramRegExp = new RegExp(":" + param + "([\\W])");
+ forEach(when.split(/[^\w:]/), function(param) {
+ if (param && param.charAt(0) === ':') {
+ var paramRegExp = new RegExp(param + "([\\W])");
if (regex.match(paramRegExp)) {
regex = regex.replace(paramRegExp, "([^\\/]*)$1");
- params.push(param);
+ params.push(param.substr(1));
}
}
});