Using AngularJS + ui-router, I need to map the URL to one of two words:
i.e. /oneWord/... or /secondWord ...
Routing and controllers are almost identical, so I want to avoid code duplication.
However, using the regex that I'm used to doesn't work where regular expressions should work:
url: '/{type:(oneWord|secondWord)}/:group',
However, this causes an error:
Unbalanced capture group in route '/{type:(oneWord|secondWord)}/:group'
A regex should work because it works fine:
url: "/{page:[0-9]{1,8}}"
I know that (oneWord|secondWord) is a valid regex, so what did I miss?
angularjs regex
helion3
source share