Skip to content

Instantly share code, notes, and snippets.

@loddit
Created August 4, 2014 03:53
Show Gist options
  • Select an option

  • Save loddit/2e97ea12a32f12d7427f to your computer and use it in GitHub Desktop.

Select an option

Save loddit/2e97ea12a32f12d7427f to your computer and use it in GitHub Desktop.
avoid :option? route parse problem https://github.com/angular/angular.js/pull/8200/
diff --git a/src/ngRoute/route.js b/src/ngRoute/route.js
index 4ecc932..2041300 100644
--- a/src/ngRoute/route.js
+++ b/src/ngRoute/route.js
@@ -580,7 +580,7 @@ function $RouteProvider(){
if (i === 0) {
result.push(segment);
} else {
- var segmentMatch = segment.match(/(\w+)(.*)/);
+ var segmentMatch = segment.match(/(\w+)\??(.*)/);
var key = segmentMatch[1];
result.push(params[key]);
result.push(segmentMatch[2] || '');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment