Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting root to '/' throws an "Invalid regular expression" error #379

Closed
agonbina opened this issue Feb 21, 2016 · 1 comment
Closed

Setting root to '/' throws an "Invalid regular expression" error #379

agonbina opened this issue Feb 21, 2016 · 1 comment

Comments

@agonbina
Copy link

I want to set the root to / so that the activeClassName is set properly for nested routes within the root(because currently if you have a route definition for /, and then other routes starting with /, ex: /cats and you navigate to /cats, both anchors to / and /cats will have the active class), but I get this exception thrown:

Invalid regular expression: /^\/: \ at end of pattern

being thrown by this line: https://github.com/vuejs/vue-router/blob/dev/src/history/html5.js#L14

@jsiebach
Copy link

Have a look at the exact option of v-link: http://vuejs.github.io/vue-router/en/link.html

usage: <a v-link="{ path: '/', exact: true }"></a>

This way the link will only be active if the route path is matched exactly, and won't be highlighted when the user is at /cats

tejitak added a commit to tejitak/vue-router that referenced this issue Mar 23, 2016
yyx990803 added a commit that referenced this issue Mar 23, 2016
Avoid an error when a root '/' for VueRouter is specified (fix #379)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants