You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/urlMatcherFactory.js
+25-3
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@
39
39
* * `'/files/*path'` - ditto.
40
40
*
41
41
* @param {string} pattern the pattern to compile into a matcher.
42
+
* @param {bool} caseInsensitiveMatch true if url matching should be case insensitive, otherwise false, the default value (for backward compatibility) is false.
42
43
*
43
44
* @property {string} prefix A static prefix of this pattern. The matcher guarantees that any
44
45
* URL matching this matcher (i.e. any string for which {@link ui.router.util.type:UrlMatcher#methods_exec exec()} returns
@@ -55,7 +56,7 @@
55
56
*
56
57
* @returns {Object} New UrlMatcher object
57
58
*/
58
-
functionUrlMatcher(pattern){
59
+
functionUrlMatcher(pattern,caseInsensitiveMatch){
59
60
60
61
// Find all placeholders and create a compiled pattern, using either classic or curly syntax:
61
62
// '*' name
@@ -119,7 +120,12 @@ function UrlMatcher(pattern) {
119
120
120
121
compiled+=quoteRegExp(segment)+'$';
121
122
segments.push(segment);
122
-
this.regexp=newRegExp(compiled);
123
+
if(caseInsensitiveMatch){
124
+
this.regexp=newRegExp(compiled,'i');
125
+
}else{
126
+
this.regexp=newRegExp(compiled);
127
+
}
128
+
123
129
this.prefix=segments[0];
124
130
}
125
131
@@ -263,6 +269,22 @@ UrlMatcher.prototype.format = function (values) {
0 commit comments