aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaitlin Potter2014-01-21 18:15:05 -0500
committerCaitlin Potter2014-01-21 19:56:57 -0500
commitfd6bac7de56f728a89782dc80c78f7d5c21bbc65 (patch)
treea87f20b83449ff6711dd77c66c820508d2021595
parent6d525f06c0c78f2f06b4e9968478053673e1832d (diff)
downloadangular.js-fd6bac7de56f728a89782dc80c78f7d5c21bbc65.tar.bz2
fix(ngRoute): pipe preceding route param no longer masks ? or * operator
Before this change, ```js $routeProvider.when('/foo/:bar|?', { ... }); ``` would not have the expected effect --- the parameter would not be optional, and the pipe would not be included in the parameter name. Following this change, the presence of the pipe operator will typically cause an exception to be thrown due to the fact that the generated regexp is invalid. The net result of this change is that ? and * operators will not be masked, and pipe operators will need to be removed, although it's unexpected that these are being used anywhere. Closes #5920
-rw-r--r--src/ngRoute/route.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ngRoute/route.js b/src/ngRoute/route.js
index 34f3f9ec..2d7ce8e4 100644
--- a/src/ngRoute/route.js
+++ b/src/ngRoute/route.js
@@ -185,7 +185,7 @@ function $RouteProvider(){
path = path
.replace(/([().])/g, '\\$1')
- .replace(/(\/)?:(\w+)([\?|\*])?/g, function(_, slash, key, option){
+ .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option){
var optional = option === '?' ? option : null;
var star = option === '*' ? option : null;
keys.push({ name: key, optional: !!optional });