mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
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
This commit is contained in:
parent
6d525f06c0
commit
fd6bac7de5
1 changed files with 1 additions and 1 deletions
|
|
@ -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 });
|
||||
|
|
|
|||
Loading…
Reference in a new issue